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.robot
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
31 [Documentation] Initiate the connection to OVSDB node from controller
33 Connect To Ovsdb Node ${MININET1}
35 Connect controller to OVSDB Node2
36 [Documentation] Initiate the connection to OVSDB node from controller
38 Connect To Ovsdb Node ${MININET}
40 Get Operational Topology from OVSDB Node1 and OVSDB Node2
41 [Documentation] This request will fetch the operational topology from the connected OVSDB nodes
43 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${node_list1}
45 Delete the integration Bridge from OVSDB node 1 and 2 and Verify it
46 [Documentation] This request will delete the integation bridge node from the OVSDB as we don't need it and verify the operation.
48 Delete Bridge From Ovsdb Node ${MININET} br-int
49 Delete Bridge From Ovsdb Node ${MININET1} br-int
50 @{list} Create List br-int
51 Wait Until Keyword Succeeds 8s 2s Check For Elements Not At URI ${OPERATIONAL_TOPO_API} ${list}
53 Start the Mininet and create custom topology
54 [Documentation] This will start mininet with custom topology on both the Virtual Machines
56 ${conn_id1} Start Mininet ${MININET1} ${start1} ${OVSDB_CONFIG_DIR}/ovsdb.py
57 Set Global Variable ${conn_id1}
58 ${conn_id2} Start Mininet ${MININET} ${start2} ${OVSDB_CONFIG_DIR}/ovsdb.py
59 Set Global Variable ${conn_id2}
61 Get Operational Topology with custom topology
62 [Documentation] This request will fetch the operational topology from the connected OVSDB nodes to make sure the mininet created custom topology
64 @{list} Create List s1 s2
65 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
67 Add the bridge s1 in the config datastore of OVSDB Node1
68 [Documentation] This request will add already operational bridge to the config data store of the OVSDB node.
70 Add Bridge To Ovsdb Node ${MININET1} s1 0000000000000001
72 Add the bridge s2 in the config datastore of OVSDB Node2
73 [Documentation] This request will add already operational bridge to the config data store of the OVSDB node.
75 Add Bridge To Ovsdb Node ${MININET} s2 0000000000000002
77 Get Config Topology with s1 and s2 Bridges
78 [Documentation] This will fetch the configuration topology from configuration data store to verify the bridge is added to the config data store
80 @{list} Create List s1 s2
81 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${CONFIG_TOPO_API} ${list}
83 Create Vxlan Port and attach to s1 Bridge
84 [Documentation] This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s1 of OVSDB node 1
86 Add Vxlan To Bridge ${MININET} s2 vxlanport ${MININET1}
88 Create Vxlan Port and attach to s2 Bridge
89 [Documentation] This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s2 of OVSDB node 2
91 Add Vxlan To Bridge ${MININET1} s1 vxlanport ${MININET}
93 Get Operational Topology with vxlan tunnel
94 [Documentation] This request will fetch the operational topology from the connected OVSDB nodes to verify that the vxlan tunnel is created
96 @{list} Create List vxlanport ${MININET1} ${MININET}
97 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
99 Add Flow1 Rule for s1 and verify
100 [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
102 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule1.xml
103 Set Suite Variable ${body}
104 Log URL is ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1
105 ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1 headers=${HEADERS_XML} data=${body}
107 Should Be Equal As Strings ${resp.status_code} 200
108 ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1 headers=${ACCEPT_XML}
109 Should Be Equal As Strings ${resp.status_code} 200
110 compare xml ${body} ${resp.content}
112 Add Flow2 Rule for s1 and verify
113 [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
115 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule2.xml
116 Log URL is ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2
117 ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2 headers=${HEADERS_XML} data=${body}
119 Should Be Equal As Strings ${resp.status_code} 200
120 ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2 headers=${ACCEPT_XML}
121 Should Be Equal As Strings ${resp.status_code} 200
122 compare xml ${body} ${resp.content}
124 Get Operational Topology to verify the flows successfully installed in the bridge s1
125 [Documentation] This request will fetch the operational topology and verify that the flows has been installed in the switch
127 @{list} Create List openflow:1
128 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
130 Add Flow1 Rule for s2 and verify
131 [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
133 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule1.xml
134 Log URL is ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1
135 ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1 headers=${HEADERS_XML} data=${body}
137 Should Be Equal As Strings ${resp.status_code} 200
138 ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1 headers=${ACCEPT_XML}
139 Should Be Equal As Strings ${resp.status_code} 200
140 compare xml ${body} ${resp.content}
142 Add Flow2 Rule for s2 and verify
143 [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
145 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule2.xml
146 Log URL is ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2
147 ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2 headers=${HEADERS_XML} data=${body}
149 Should Be Equal As Strings ${resp.status_code} 200
150 ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2 headers=${ACCEPT_XML}
151 Should Be Equal As Strings ${resp.status_code} 200
152 compare xml ${body} ${resp.content}
154 Get Operational Topology to verify the flows successfully installed in the bridge s2
155 [Documentation] This request will fetch the operational topology and verify that the flows has been installed in the switch
157 @{list} Create List openflow:2
158 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
160 Ping host2 to IP of host1
161 [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
162 Switch Connection ${conn_id2}
163 SSHLibrary.Write h2 ping -w 1 10.0.0.1
164 ${result} Read Until mininet>
165 Should Contain ${result} 1 received, 0% packet loss
167 Cleanup work after test completed
168 [Documentation] Cleanup/Shutdown work that should be done at the completion of all tests
169 Stop Mininet ${conn_id2}
170 Stop Mininet ${conn_id1}
172 Disconnect controller connection from the connected OVSDBs nodes
173 [Documentation] This request will disconnect the controller from the connected OVSDB node for clean startup for next suite.
175 Disconnect From Ovsdb Node ${MININET}
176 Disconnect From Ovsdb Node ${MININET1}
178 Verify that the operational topology is clean
179 [Documentation] This request will verify the operational toplogy after the mininet is cleaned.
181 @{list} Create List ${MININET} ${MININET1} s1 s2
182 Wait Until Keyword Succeeds 8s 2s Check For Elements Not At URI ${OPERATIONAL_TOPO_API} ${list}