Last modified by Kevin Austin on 2018/11/29 05:19

Show last authors
1 In this guide, we'll be setting up a simple mininet test network and adding a flow to allow two hosts to ping each other. There is a mininet container in OpenKilda that is used to perform automated testing of controller builds, but for this guide, we'll instead install mininet on the host operating system. These instructions were written using the October 2018 OpenKilda build v1.1.10.4
2
3 This guide uses a python script, datacenterConfigurable.py to create different network topologies and [[can be downloaded here>>attach:datacenterConfigurable.py.zip]]. The script creates a typical datacenter leaf/spine topology where you can specify the number of racks and hosts per rack when you start mininet. For this walkthrough, our network will consist of a simple 2 rack configuration with 2 ToR switches with one host per rack and a single spine switch.
4
5 = Modify the docker-compose.yml File =
6
7 To avoid a conflict between mininet and floodlight which both use port 6655, we are going to modify the docker-compose.yml file in the base open-kilda folder. We'll make a copy of the original file to preserve it.
8
9 (% class="box" %)
10 (((
11 (% style="font-family:Courier New,Courier,monospace" %)user@host:~~/open-kilda$ **sudo cp docker-compose.yml docker-compose.yml.original**
12 )))
13
14 Now, open up the docker-compose.yml file in nano
15
16 (% class="box" %)
17 (((
18 (% style="font-family:Courier New,Courier,monospace" %)user@host:~~/open-kilda$ **sudo nano docker-compose.yml**
19 )))
20
21 Scroll down to the floodlight configuration and (-) delete the line (% style="font-family:Courier New,Courier,monospace" %) - "6655:6655"
22
23 (% class="box" %)
24 (((
25 (% style="font-family:Courier New,Courier,monospace" %)ports:
26 - "6653:6653"
27 - "8180:8080"
28 -- - "6655:6655"--
29 - "6642:6642"
30 - "8081:8080"
31 depends_on:
32 kafka:
33 )))
34
35 After deleting this line, hit control+x , hit Y to save and press Enter to exit.
36
37 = Install Mininet =
38
39 Install mininet using apt install
40
41 (% class="box" %)
42 (((
43 (% style="font-family:Courier New,Courier,monospace" %)user@host:~~/open-kilda$ **sudo apt install mininet**
44 )))
45
46 = Install the datacenterConfigurable.py Script =
47
48 Now that mininet is installed, download the mininet script [[datacenterConfigurable.py.zip >>attach:datacenterConfigurable.py.zip]]to the host machine.
49
50 If you've downloaded the file from a browser on the host ubuntu machine, we'll unzip it and copy it into the home directory:
51
52 (% class="box" %)
53 (((
54 (% style="font-family:Courier New,Courier,monospace" %)user@host:~~/open-kilda$ **unzip ~~/Downloads/datacenterConfigurable.py.zip -d ~~**
55 )))
56
57 = Start OpenKilda =
58
59 If you already have OpenKilda running it, stop and restart it so that the changes we made earlier to the docker-compose.yml file take affect.
60
61 If OpenKilda is already running in the foreground of the terminal window, hit control+c, this will stop OpenKilda.
62
63 If OpenKilda is running in the background, in the ~~/open-kilda folder type:
64
65 (% class="box" %)
66 (((
67 (% style="font-family:Courier New,Courier,monospace" %)user@host:~~/open-kilda$ **docker-compose down**
68 )))
69
70 Now start OpenKilda from the base ~~/open-kilda folder:
71
72 (% class="box" %)
73 (((
74 (% style="font-family:Courier New,Courier,monospace" %)user@host:~~/open-kilda$ **docker-compose up**
75 )))
76
77 Once OpenKilda has started, open a browser and go to http:~/~/127.0.0.1:8010/openkilda . It may take 30-45 seconds after Kilda has fully started for the page to be active. Login using the credentials -  Username: admin Password: admin and click on the Topology link on the left hand navigation bar. The Topology window will be empty.
78
79 (% style="text-align:center" %)
80 [[image:topology_empty.jpg||height="318" width="500"]]
81
82
83 = Toggle Controller Features - Set to True =
84
85 In a browser window, open the Swagger interface: http:~/~/127.0.0.1:8080/api/v1/swagger-ui.html#/
86
87 Username: kilda
88 Password: kilda
89 \\Swagger allows us to access the northbound interface of OpenKilda through a web browser. By default, many of the controller features are turned off. In a normal production environment you may want to control what features are available to configure the network. Click on the (% style="font-family:Courier New,Courier,monospace" %)feature-toggles-controller(%%) tab to expand it. Then click on the "GET /features" tab to expand the tab.  In the top-right corner of the tab select "try it out" and then click the blue "Execute" button.
90
91 (% style="text-align:center" %)
92 [[image:feature-toggles-controller.jpeg||height="379" width="600"]]
93
94 The following will be returned in the Response body field:
95
96 (% class="box" %)
97 (((
98 {
99 "sync_rules": false,
100 "reflow_on_switch_activation": true,
101 "create_flow": false,
102 "update_flow": false,
103 "delete_flow": false,
104 "push_flow": false,
105 "unpush_flow": false
106 }
107 )))
108
109 Most of the features are turned off by default. To enable these features, scroll down to the "POST /features" tab and click on it to expand it. Click on the "try it out" button and then click on the big blue "Execute" button.
110
111 (% style="text-align:center" %)
112 [[image:post_features.jpeg||height="387" width="600"]]
113
114
115 (% class="wikigeneratedid" %)
116 By default you should have the following example values:
117
118 (% class="box" %)
119 (((
120 {
121 "create_flow": true,
122 "delete_flow": true,
123 "push_flow": true,
124 "reflow_on_switch_activation": true,
125 "sync_rules": true,
126 "unpush_flow": true,
127 "update_flow": true
128 }
129 )))
130
131 (% class="wikigeneratedid" %)
132 Verify that the features were enabled by going back to the "GET /features" tab and clicking on the big blue "Execute" button. Verify that the Response body now lists "true" as the value for all of the features.
133
134 = Start Mininet =
135
136 In a new terminal window navigate to the home folder where the datacenterConfigurable.py script it located:
137
138 (% class="box" %)
139 (((
140 (% style="font-family:Courier New,Courier,monospace" %)user@host:~~/open-kilda$ **cd ~~**
141 )))
142
143 Use the following command to start a 2 host | 2 ToR | 1 Spine | switch topology
144
145 (% class="box" %)
146 (((
147 (% style="font-family:Courier New,Courier,monospace" %)user@host:~~/$ **sudo mn ~-~-custom datacenterConfigurable.py ~-~-topo dcconfig,2,1 ~-~-switch ovs ~-~-controller remote,ip=127.0.0.1,port=6653**
148 )))
149
150 The following topology will be created:
151
152 (% class="box" %)
153 (((
154 (% style="font-family:Courier New,Courier,monospace" %)~*~** Creating network
155 ~*~*~* Adding controller
156 ~*~*~* Adding hosts:
157 h1r1 h1r2
158 ~*~*~* Adding switches:
159 s1 s1r1 s1r2
160 ~*~*~* Adding links:
161 (s1, s1r1) (s1, s1r2) (s1r1, h1r1) (s1r2, h1r2)
162 ~*~*~* Configuring hosts
163 h1r1 h1r2
164 ~*~*~* Staring controller
165 c0
166 ~*~*~* Starting 3 switches
167 s1 s1r1 s1r2
168 ~*~*~* Starting CLI:
169 mininet>
170 )))
171
172 = Verify Topology in GUI =
173
174 Verify in the OpenKilda GUI that the topology was created, in a browser go to: http:~/~/127.0.0.1:8010/openkilda/topology or refresh the window that you had open previously. You should now see that 3 switches and 2 links are present. You can rollover the switches or the links connecting them to get their information. For reference, OpenKilda considers any port connected to another switch an "ISL". OpenKilda does not display "hosts" or computers in the topology, ports that are connected to hosts are termed "ports" in OpenKilda. We have built the following topology with mininet:
175
176 s1 (spine switch) switch ID: 00:00:00:00:00:00:00:01
177 ISL Link: Port 1 is connected to Destination port 2 of 00:00:00:00:00:00:00:11
178 ISL Link:  Port 2 is connected to Destination port 2 of 00:00:00:00:00:00:00:21
179 \\s1r1 switch ID: 00:00:00:00:00:00:00:11
180 ISL Link: Port 2 is connected to s1 Switch ID: 00:00:00:00:00:00:00:01
181 Port Link: Port 1 is connected to h1r1
182 \\s1r2 switch ID: 00:00:00:00:00:00:00:21
183 ISL Link: Port 2 is connected to s1 switch ID: 00:00:00:00:00:00:00:01
184 Port Link: Port 1 is connected to h1r2
185
186 (% style="text-align:center" %)
187 [[image:3switch_topology.jpg||height="440" width="800"]]
188
189 = Creating a Flow Between Two Hosts =
190
191 Now that we have the network setup, we are going to create a flow between the host in r1 and the host in r2 across the network. In OpenKilda we only need to specify the source port and the destination port, the Path Computation Engine will create the rest of the flows through the network and create a return path to make the flow bi-directional. This will allow us to ping between our hosts.
192
193 To create our flow we will use the Swagger interface to push a flow through the northbound API of OpenKilda. Go to http:~/~/127.0.0.1:8080/api/v1/swagger-ui.html# . Click on the flow-controller tab to expand it. Click on the orange "Put /flows" tab to expand it. Click on the "try it out" button on the top right corner fo the tab. In the example value window, the flow we want to enter is:
194
195
196 (% class="box" %)
197 (((
198 (% style="font-family:Courier New,Courier,monospace" %){
199 "description": "mininet test flow",
200 "destination": {
201 "port-id": 1,
202 "switch-id": "00:00:00:00:00:00:00:21",
203 "vlan-id": 0
204 },
205 "flowid": "flow1",
206 "ignore_bandwidth": true,
207 "last-updated": "string",
208 "maximum-bandwidth": 0,
209 "periodic-pings": true,
210 "source": {
211 "port-id": 1,
212 "switch-id": "00:00:00:00:00:00:00:11",
213 "vlan-id": 0
214 },
215 "status": "sting"
216 }
217 )))
218
219 Click the blue "Execute" button and make sure there are no error messages in the response body. If the flow was entered correctly you should see the following in the response body:
220
221 (% style="text-align:center" %)
222 [[image:flow_creation.jpeg||height="428" width="700"]]
223
224 = Ping Between Mininet Hosts =
225
226 Return to your mininet terminal window and ping between the two hosts:
227
228 (% class="box" %)
229 (((
230 (% style="font-family:Courier New,Courier,monospace" %)mininet> **h1r1 ping h1r2**
231 )))
232
233 You should now be able to ping between your two hosts.
234
235 = Check Flow Status =
236
237 In the OpenKilda GUI at http:~/~/127.0.0.1/openkilda you can check the status of the flow. If you select Flows in the left hand navigation menu it will list the flows installed in the network. Double-click on our test flow we entered and it will display the parameters of the flow and a graph of the number of packets per second for the flow. You can select different parameters to metrics and time periods to graph.
238
239 (% style="text-align:center" %)
240 [[image:flow_graph.jpeg||height="407" width="700"]]
241
242 If you click the "path" tab it will show you the path the flow is taking through the network including the "switches" and the "ISL" links.
243
244 (% style="text-align:center" %)
245 [[image:path_window.jpeg||height="412" width="700"]]
246
247
©2018 OpenKilda