blob: 80716cf0d212f869c1917569d104d72670071fcc [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
Simon Hunt5b4d6652017-02-27 10:56:00 -080074null-create-device switch SPINE-B-1 ${nports} 10.0 20.0 grid
75null-create-device switch SPINE-B-2 ${nports} 10.0 50.0 grid
76null-create-device switch SPINE-B-3 ${nports} 10.0 80.0 grid
77null-create-device switch SPINE-B-4 ${nports} 10.0 110.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -080078
Simon Hunt5b4d6652017-02-27 10:56:00 -080079null-create-device switch LEAF-B-1 ${nports} 45.0 20.0 grid
80null-create-device switch LEAF-B-2 ${nports} 45.0 50.0 grid
81null-create-device switch LEAF-B-3 ${nports} 45.0 80.0 grid
82null-create-device switch LEAF-B-4 ${nports} 45.0 110.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -080083
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
Simon Hunt5b4d6652017-02-27 10:56:00 -0800106null-create-device switch SPINE-C-1 ${nports} 10.0 20.0 grid
107null-create-device switch SPINE-C-2 ${nports} 10.0 50.0 grid
108null-create-device switch SPINE-C-3 ${nports} 10.0 80.0 grid
109null-create-device switch SPINE-C-4 ${nports} 10.0 110.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -0800110
Simon Hunt5b4d6652017-02-27 10:56:00 -0800111null-create-device switch LEAF-C-1 ${nports} 45.0 20.0 grid
112null-create-device switch LEAF-C-2 ${nports} 45.0 50.0 grid
113null-create-device switch LEAF-C-3 ${nports} 45.0 80.0 grid
114null-create-device switch LEAF-C-4 ${nports} 45.0 110.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -0800115
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
Simon Hunt5b4d6652017-02-27 10:56:00 -0800138null-create-device switch SPINE-D-1 ${nports} 10.0 20.0 grid
139null-create-device switch SPINE-D-2 ${nports} 10.0 50.0 grid
140null-create-device switch SPINE-D-3 ${nports} 10.0 80.0 grid
141null-create-device switch SPINE-D-4 ${nports} 10.0 110.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -0800142
Simon Hunt5b4d6652017-02-27 10:56:00 -0800143null-create-device switch LEAF-D-1 ${nports} 45.0 20.0 grid
144null-create-device switch LEAF-D-2 ${nports} 45.0 50.0 grid
145null-create-device switch LEAF-D-3 ${nports} 45.0 80.0 grid
146null-create-device switch LEAF-D-4 ${nports} 45.0 110.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -0800147
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
Simon Hunt5b4d6652017-02-27 10:56:00 -0800185null-create-host LEAF-A-1 192.168.1.1 60.0 15.0 grid
186null-create-host LEAF-A-2 192.168.2.1 60.0 45.0 grid
187null-create-host LEAF-A-3 192.168.3.1 60.0 85.0 grid
188null-create-host LEAF-A-4 192.168.4.1 60.0 115.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -0800189
Simon Hunt5b4d6652017-02-27 10:56:00 -0800190null-create-host LEAF-B-1 192.168.51.1 60.0 15.0 grid
191null-create-host LEAF-B-2 192.168.52.1 60.0 45.0 grid
192null-create-host LEAF-B-3 192.168.53.1 60.0 85.0 grid
193null-create-host LEAF-B-4 192.168.54.1 60.0 115.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -0800194
Simon Hunt5b4d6652017-02-27 10:56:00 -0800195null-create-host LEAF-C-1 192.168.101.1 60.0 15.0 grid
196null-create-host LEAF-C-2 192.168.102.1 60.0 45.0 grid
197null-create-host LEAF-C-3 192.168.103.1 60.0 85.0 grid
198null-create-host LEAF-C-4 192.168.104.1 60.0 115.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -0800199
Simon Hunt5b4d6652017-02-27 10:56:00 -0800200null-create-host LEAF-D-1 192.168.151.1 60.0 15.0 grid
201null-create-host LEAF-D-2 192.168.152.1 60.0 45.0 grid
202null-create-host LEAF-D-3 192.168.153.1 60.0 85.0 grid
203null-create-host LEAF-D-4 192.168.154.1 60.0 115.0 grid
Simon Hunteb3cf542017-02-10 13:18:41 -0800204
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 Hunted81ed62017-03-21 17:53:38 -0700265# layout-add <layout-id> <bg-ref> \
266# [ <region-id> <parent-layout-id> <scale> <offset-x> <offset-y> ]
267#
Simon Hunteb3cf542017-02-10 13:18:41 -0800268
269onos ${host} <<-EOF
270
Simon Hunted81ed62017-03-21 17:53:38 -0700271layout-add root @bayareaGEO . . 0.4
Simon Hunte9717e62017-02-16 16:54:43 -0800272
Simon Hunted81ed62017-03-21 17:53:38 -0700273layout-add lC01 +segmentRouting c01 . 0.9 5.2 -4.0
Simon Hunte9717e62017-02-16 16:54:43 -0800274layout-add lC02 +segmentRouting c02
275layout-add lC03 +segmentRouting c03
276layout-add lC04 . c04 # testing no-background
Simon Hunteb3cf542017-02-10 13:18:41 -0800277
278layouts
279
280EOF
281
282
283### Set up debug log messages for classes we care about
284
285onos ${host} <<-EOF
286
287log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
288log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier
289log:set DEBUG org.onosproject.ui.impl.UiWebSocket
290log:set DEBUG org.onosproject.ui.impl.UiTopoSession
291log:list
292
293EOF