blob: f37373fa6610c9d345787f5922479dbc550fb6cd [file] [log] [blame]
Simon Hunt53612212016-12-04 17:19:52 -08001#!/bin/bash
2#
3# A test topology of four data centers (spine-leaf fabrics), configured as
4# four sub-regions, and positioned in the Bay Area (geographically speaking).
5#
6# Script Configuration:
7#
8# host : the controller instance against which this script is run
9# nports : the number of ports to configure on each switch
10# sleepfor : the number of seconds to wait for sim to restart
11
12host=${1:-127.0.0.1}
13nports=16
14sleepfor=5
15
16### start up null provider
17
18onos ${host} null-simulation stop custom
19onos ${host} wipe-out please
20onos ${host} null-simulation start custom
21
22
23## unfortunately, it takes a time for the sim to start up
24# this is not ideal...
25
26echo
27echo "Sleeping while sim starts up... (${sleepfor} seconds)..."
28echo
29sleep ${sleepfor}
30
31
32### Add devices and links
33#
34# null-create-device <type> <name> <#ports> <latitude> <longitude>
35# null-create-link <type> <src> <dst>
36
37onos ${host} <<-EOF
38
39# root region
40
41# CO 1
42null-create-device switch SPINE-A-1 ${nports} 37.783197 -122.503738
43null-create-device switch SPINE-A-2 ${nports} 37.783972 -122.463738
44null-create-device switch SPINE-A-3 ${nports} 37.783972 -122.423738
45null-create-device switch SPINE-A-4 ${nports} 37.783972 -122.383738
46
47null-create-device switch LEAF-A-1 ${nports} 37.733972 -122.503738
48null-create-device switch LEAF-A-2 ${nports} 37.733972 -122.463738
49null-create-device switch LEAF-A-3 ${nports} 37.733972 -122.423738
50null-create-device switch LEAF-A-4 ${nports} 37.733972 -122.383738
51
52# Links in CO 1
53null-create-link direct LEAF-A-1 SPINE-A-1
54null-create-link direct LEAF-A-1 SPINE-A-2
55null-create-link direct LEAF-A-1 SPINE-A-3
56null-create-link direct LEAF-A-1 SPINE-A-4
57
58null-create-link direct LEAF-A-2 SPINE-A-1
59null-create-link direct LEAF-A-2 SPINE-A-2
60null-create-link direct LEAF-A-2 SPINE-A-3
61null-create-link direct LEAF-A-2 SPINE-A-4
62
63null-create-link direct LEAF-A-3 SPINE-A-1
64null-create-link direct LEAF-A-3 SPINE-A-2
65null-create-link direct LEAF-A-3 SPINE-A-3
66null-create-link direct LEAF-A-3 SPINE-A-4
67
68null-create-link direct LEAF-A-4 SPINE-A-1
69null-create-link direct LEAF-A-4 SPINE-A-2
70null-create-link direct LEAF-A-4 SPINE-A-3
71null-create-link direct LEAF-A-4 SPINE-A-4
72
73# CO 2
74null-create-device switch SPINE-B-1 ${nports} 37.458236 -122.252604
75null-create-device switch SPINE-B-2 ${nports} 37.458236 -122.212604
76null-create-device switch SPINE-B-3 ${nports} 37.458236 -122.172604
77null-create-device switch SPINE-B-4 ${nports} 37.458236 -122.132604
78
79null-create-device switch LEAF-B-1 ${nports} 37.418236 -122.252604
80null-create-device switch LEAF-B-2 ${nports} 37.418236 -122.212604
81null-create-device switch LEAF-B-3 ${nports} 37.418236 -122.172604
82null-create-device switch LEAF-B-4 ${nports} 37.418236 -122.132604
83
84# Links in CO 2
85null-create-link direct LEAF-B-1 SPINE-B-1
86null-create-link direct LEAF-B-1 SPINE-B-2
87null-create-link direct LEAF-B-1 SPINE-B-3
88null-create-link direct LEAF-B-1 SPINE-B-4
89
90null-create-link direct LEAF-B-2 SPINE-B-1
91null-create-link direct LEAF-B-2 SPINE-B-2
92null-create-link direct LEAF-B-2 SPINE-B-3
93null-create-link direct LEAF-B-2 SPINE-B-4
94
95null-create-link direct LEAF-B-3 SPINE-B-1
96null-create-link direct LEAF-B-3 SPINE-B-2
97null-create-link direct LEAF-B-3 SPINE-B-3
98null-create-link direct LEAF-B-3 SPINE-B-4
99
100null-create-link direct LEAF-B-4 SPINE-B-1
101null-create-link direct LEAF-B-4 SPINE-B-2
102null-create-link direct LEAF-B-4 SPINE-B-3
103null-create-link direct LEAF-B-4 SPINE-B-4
104
105# CO 3
106null-create-device switch SPINE-C-1 ${nports} 37.338208 -121.926329
107null-create-device switch SPINE-C-2 ${nports} 37.338208 -121.886329
108null-create-device switch SPINE-C-3 ${nports} 37.338208 -121.846329
109null-create-device switch SPINE-C-4 ${nports} 37.338208 -121.806329
110
111null-create-device switch LEAF-C-1 ${nports} 37.298208 -121.926329
112null-create-device switch LEAF-C-2 ${nports} 37.298208 -121.886329
113null-create-device switch LEAF-C-3 ${nports} 37.298208 -121.846329
114null-create-device switch LEAF-C-4 ${nports} 37.298208 -121.806329
115
116# Links in CO 3
117null-create-link direct LEAF-C-1 SPINE-C-1
118null-create-link direct LEAF-C-1 SPINE-C-2
119null-create-link direct LEAF-C-1 SPINE-C-3
120null-create-link direct LEAF-C-1 SPINE-C-4
121
122null-create-link direct LEAF-C-2 SPINE-C-1
123null-create-link direct LEAF-C-2 SPINE-C-2
124null-create-link direct LEAF-C-2 SPINE-C-3
125null-create-link direct LEAF-C-2 SPINE-C-4
126
127null-create-link direct LEAF-C-3 SPINE-C-1
128null-create-link direct LEAF-C-3 SPINE-C-2
129null-create-link direct LEAF-C-3 SPINE-C-3
130null-create-link direct LEAF-C-3 SPINE-C-4
131
132null-create-link direct LEAF-C-4 SPINE-C-1
133null-create-link direct LEAF-C-4 SPINE-C-2
134null-create-link direct LEAF-C-4 SPINE-C-3
135null-create-link direct LEAF-C-4 SPINE-C-4
136
137# CO 4
138null-create-device switch SPINE-D-1 ${nports} 37.556826 -122.051926
139null-create-device switch SPINE-D-2 ${nports} 37.556826 -122.011926
140null-create-device switch SPINE-D-3 ${nports} 37.556826 -121.971926
141null-create-device switch SPINE-D-4 ${nports} 37.556826 -121.931926
142
143null-create-device switch LEAF-D-1 ${nports} 37.516826 -122.051926
144null-create-device switch LEAF-D-2 ${nports} 37.516826 -122.011926
145null-create-device switch LEAF-D-3 ${nports} 37.516826 -121.971926
146null-create-device switch LEAF-D-4 ${nports} 37.516826 -121.931926
147
148# Links in CO 4
149null-create-link direct LEAF-D-1 SPINE-D-1
150null-create-link direct LEAF-D-1 SPINE-D-2
151null-create-link direct LEAF-D-1 SPINE-D-3
152null-create-link direct LEAF-D-1 SPINE-D-4
153
154null-create-link direct LEAF-D-2 SPINE-D-1
155null-create-link direct LEAF-D-2 SPINE-D-2
156null-create-link direct LEAF-D-2 SPINE-D-3
157null-create-link direct LEAF-D-2 SPINE-D-4
158
159null-create-link direct LEAF-D-3 SPINE-D-1
160null-create-link direct LEAF-D-3 SPINE-D-2
161null-create-link direct LEAF-D-3 SPINE-D-3
162null-create-link direct LEAF-D-3 SPINE-D-4
163
164null-create-link direct LEAF-D-4 SPINE-D-1
165null-create-link direct LEAF-D-4 SPINE-D-2
166null-create-link direct LEAF-D-4 SPINE-D-3
167null-create-link direct LEAF-D-4 SPINE-D-4
168
169# Inter-CO Links
170null-create-link direct LEAF-A-4 LEAF-B-1
171null-create-link direct LEAF-A-4 LEAF-C-1
172null-create-link direct LEAF-A-4 LEAF-D-4
173null-create-link direct LEAF-B-1 LEAF-C-1
174null-create-link direct LEAF-B-1 LEAF-D-4
175null-create-link direct LEAF-C-1 LEAF-D-4
176
177EOF
178
179### Add a host per device
180#
181# null-create-host <device-id> <host-ip> <latitude> <longitude>
182
183onos ${host} <<-EOF
184
185null-create-host LEAF-A-1 192.168.1.1 37.703972 -122.503738
186null-create-host LEAF-A-2 192.168.2.1 37.703972 -122.463738
187null-create-host LEAF-A-3 192.168.3.1 37.703972 -122.423738
188null-create-host LEAF-A-4 192.168.4.1 37.703972 -122.383738
189
190null-create-host LEAF-B-1 192.168.51.1 37.388236 -122.252604
191null-create-host LEAF-B-2 192.168.52.1 37.388236 -122.212604
192null-create-host LEAF-B-3 192.168.53.1 37.388236 -122.172604
193null-create-host LEAF-B-4 192.168.54.1 37.388236 -122.132604
194
195null-create-host LEAF-C-1 192.168.101.1 37.268208 -121.926329
196null-create-host LEAF-C-2 192.168.102.1 37.268208 -121.886329
197null-create-host LEAF-C-3 192.168.103.1 37.268208 -121.846329
198null-create-host LEAF-C-4 192.168.104.1 37.268208 -121.806329
199
200null-create-host LEAF-D-1 192.168.151.1 37.476826 -122.051926
201null-create-host LEAF-D-2 192.168.152.1 37.476826 -122.011926
202null-create-host LEAF-D-3 192.168.153.1 37.476826 -121.971926
203null-create-host LEAF-D-4 192.168.154.1 37.476826 -121.931926
204
205EOF
206
207### Add regions and associate devices with them
208#
Simon Hunt0ee20bf2017-05-10 19:59:17 -0700209# region-add <region-id> <region-name> <region-type> \
210# <lat/Y> <long/X> <locType> <region-master>
Simon Hunt53612212016-12-04 17:19:52 -0800211# region-add-devices <region-id> <device-id>...
212
213onos ${host} <<-EOF
214
Simon Hunt0ee20bf2017-05-10 19:59:17 -0700215region-add c01 SanFrancisco DATA_CENTER 37.75394143914288 -122.45945851660800 geo ${host}
216region-add c02 PaloAlto DATA_CENTER 37.45466637790734 -122.21838933304870 geo ${host}
217region-add c03 SanJose DATA_CENTER 37.34425619809433 -121.94768095808017 geo ${host}
218region-add c04 Fremont DATA_CENTER 37.54328280574901 -122.01205548699211 geo ${host}
Simon Hunt53612212016-12-04 17:19:52 -0800219
220region-add-devices c01 \
221 null:0000000000000001 \
222 null:0000000000000002 \
223 null:0000000000000003 \
224 null:0000000000000004 \
225 null:0000000000000005 \
226 null:0000000000000006 \
227 null:0000000000000007 \
228 null:0000000000000008 \
229
230region-add-devices c02 \
231 null:0000000000000009 \
232 null:000000000000000a \
233 null:000000000000000b \
234 null:000000000000000c \
235 null:000000000000000d \
236 null:000000000000000e \
237 null:000000000000000f \
238 null:0000000000000010 \
239
240region-add-devices c03 \
241 null:0000000000000011 \
242 null:0000000000000012 \
243 null:0000000000000013 \
244 null:0000000000000014 \
245 null:0000000000000015 \
246 null:0000000000000016 \
247 null:0000000000000017 \
248 null:0000000000000018 \
249
250region-add-devices c04 \
251 null:0000000000000019 \
252 null:000000000000001a \
253 null:000000000000001b \
254 null:000000000000001c \
255 null:000000000000001d \
256 null:000000000000001e \
257 null:000000000000001f \
258 null:0000000000000020 \
259
260regions
261
262EOF
263
264### Add layouts, associating backing regions, and optional parent.
265#
266# layout-add <layout-id> <region-id(opt)> <parent-layout-id(opt)>
267
268onos ${host} <<-EOF
269
Simon Huntbc30e682017-02-15 18:39:23 -0800270layout-add lC01 . c01
271layout-add lC02 . c02
272layout-add lC03 . c03
273layout-add lC04 . c04
Simon Hunt53612212016-12-04 17:19:52 -0800274
275layouts
276
277EOF
278
279
280### Set up debug log messages for classes we care about
281
282onos ${host} <<-EOF
283
284log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
285log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier
286log:set DEBUG org.onosproject.ui.impl.UiWebSocket
Steven Burrows512b6272016-12-19 14:09:45 -0500287log:set DEBUG org.onosproject.ui.impl.UiTopoSession
Simon Hunt53612212016-12-04 17:19:52 -0800288log:list
289
290EOF