blob: c7b4de12881029e31650513dfd4142fa752445df [file] [log] [blame]
Simon Hunteb3cf542017-02-10 13:18:41 -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/Y> <longitude/X> [geo|grid]
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} 10.0 20.0 grid
43null-create-device switch SPINE-A-2 ${nports} 10.0 50.0 grid
44null-create-device switch SPINE-A-3 ${nports} 10.0 80.0 grid
45null-create-device switch SPINE-A-4 ${nports} 10.0 110.0 grid
46
47null-create-device switch LEAF-A-1 ${nports} 45.0 20.0 grid
48null-create-device switch LEAF-A-2 ${nports} 45.0 50.0 grid
49null-create-device switch LEAF-A-3 ${nports} 45.0 80.0 grid
50null-create-device switch LEAF-A-4 ${nports} 45.0 110.0 grid
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/Y> <longitude/X> [geo|grid]
182
183onos ${host} <<-EOF
184
185null-create-host LEAF-A-1 192.168.1.1 60.0 20.0 grid
186null-create-host LEAF-A-2 192.168.2.1 60.0 50.0 grid
187null-create-host LEAF-A-3 192.168.3.1 60.0 80.0 grid
188null-create-host LEAF-A-4 192.168.4.1 60.0 110.0 grid
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#
209# region-add <region-id> <region-name> <region-type> <region-master>
210# region-add-devices <region-id> <device-id>...
211
212onos ${host} <<-EOF
213
214region-add c01 SanFrancisco DATA_CENTER 37.75394143914288 -122.45945851660800 ${host}
215region-add c02 PaloAlto DATA_CENTER 37.45466637790734 -122.21838933304870 ${host}
216region-add c03 SanJose DATA_CENTER 37.34425619809433 -121.94768095808017 ${host}
217region-add c04 Fremont DATA_CENTER 37.54328280574901 -122.01205548699211 ${host}
218
219region-add-devices c01 \
220 null:0000000000000001 \
221 null:0000000000000002 \
222 null:0000000000000003 \
223 null:0000000000000004 \
224 null:0000000000000005 \
225 null:0000000000000006 \
226 null:0000000000000007 \
227 null:0000000000000008 \
228
229region-add-devices c02 \
230 null:0000000000000009 \
231 null:000000000000000a \
232 null:000000000000000b \
233 null:000000000000000c \
234 null:000000000000000d \
235 null:000000000000000e \
236 null:000000000000000f \
237 null:0000000000000010 \
238
239region-add-devices c03 \
240 null:0000000000000011 \
241 null:0000000000000012 \
242 null:0000000000000013 \
243 null:0000000000000014 \
244 null:0000000000000015 \
245 null:0000000000000016 \
246 null:0000000000000017 \
247 null:0000000000000018 \
248
249region-add-devices c04 \
250 null:0000000000000019 \
251 null:000000000000001a \
252 null:000000000000001b \
253 null:000000000000001c \
254 null:000000000000001d \
255 null:000000000000001e \
256 null:000000000000001f \
257 null:0000000000000020 \
258
259regions
260
261EOF
262
263### Add layouts, associating backing regions, and optional parent.
264#
Simon Huntbc30e682017-02-15 18:39:23 -0800265# layout-add <layout-id> <bg-ref> <region-id(opt)> <parent-layout-id(opt)>
Simon Hunteb3cf542017-02-10 13:18:41 -0800266
267onos ${host} <<-EOF
268
Simon Hunte9717e62017-02-16 16:54:43 -0800269layout-add root @bayareaGEO
270
Simon Huntbc30e682017-02-15 18:39:23 -0800271layout-add lC01 +segmentRouting c01
Simon Hunte9717e62017-02-16 16:54:43 -0800272layout-add lC02 +segmentRouting c02
273layout-add lC03 +segmentRouting c03
274layout-add lC04 . c04 # testing no-background
Simon Hunteb3cf542017-02-10 13:18:41 -0800275
276layouts
277
278EOF
279
280
281### Set up debug log messages for classes we care about
282
283onos ${host} <<-EOF
284
285log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
286log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier
287log:set DEBUG org.onosproject.ui.impl.UiWebSocket
288log:set DEBUG org.onosproject.ui.impl.UiTopoSession
289log:list
290
291EOF