blob: de1eb4c3abb9cc0a1202fa1fdde09bedfba3a5c0 [file] [log] [blame]
Simon Huntb3656d42017-04-07 18:15:35 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
Simon Huntb3567282017-04-07 22:59:28 -07003# Creates a Europe-based topology (with regions) using ONOS null provider
Simon Huntb3656d42017-04-07 18:15:35 -07004# -----------------------------------------------------------------------------
5
6# config
7host=${1:-localhost}
8nports=24
9sleepfor=5
10
11
12### start up null provider
13onos ${host} null-simulation stop custom
14onos ${host} wipe-out please
15onos ${host} null-simulation start custom
16
17
18## unfortunately, it takes a time for the sim to start up
Simon Hunt8f60ff82017-04-24 17:19:30 -070019# this is not ideal... but we'll live with it for now
Simon Huntb3656d42017-04-07 18:15:35 -070020
21echo
22echo "Sleeping while sim starts up... (${sleepfor} seconds)..."
23echo
24sleep ${sleepfor}
25
26
Simon Huntb3567282017-04-07 22:59:28 -070027###------------------------------------------------------
Simon Huntb3656d42017-04-07 18:15:35 -070028### Start by adding Country regions
29# Note that Long/Lat places region icon nicely in the country center
30
Simon Hunt0ee20bf2017-05-10 19:59:17 -070031# region-add <region-id> <region-name> <region-type> \
32# <lat/Y> <long/X> <locType> <region-master>
Simon Huntb3656d42017-04-07 18:15:35 -070033
34onos ${host} <<-EOF
35
Simon Hunt0ee20bf2017-05-10 19:59:17 -070036region-add rUK "United Kingdom" COUNTRY 52.206035 -1.310384 geo ${host}
37region-add rIT "Italy" COUNTRY 44.447951 11.093161 geo ${host}
38region-add rFR "France" COUNTRY 47.066264 2.711458 geo ${host}
39region-add rDE "Germany" COUNTRY 50.863152 9.761971 geo ${host}
40region-add rES "Spain" COUNTRY 40.416704 -3.7035824 geo ${host}
Simon Huntb3656d42017-04-07 18:15:35 -070041
Simon Hunt0ee20bf2017-05-10 19:59:17 -070042region-add rMilan "Milan" METRO 45.4654 9.1859 geo ${host}
Simon Huntc4ca7102017-04-08 22:28:04 -070043
Simon Huntb3656d42017-04-07 18:15:35 -070044EOF
45
46
47###------------------------------------------------------
Simon Huntb3656d42017-04-07 18:15:35 -070048### Add layouts, associating backing regions, and optional parent.
49# layout-add <layout-id> <bg-ref> \
50# [ <region-id> <parent-layout-id> <scale> <offset-x> <offset-y> ]
51#
52
53onos ${host} <<-EOF
54
55# -- root layout
Steven Burrows67713d42017-04-11 11:35:20 -070056layout-add root @europe . . 4.66 -2562.93 -412.56
Simon Huntb3656d42017-04-07 18:15:35 -070057
58# -- layouts for top level regions
Simon Hunt0d7bbfc2017-06-04 10:51:47 -070059layout-add lUK @europe rUK root 14.82 -8533.83 -1377.96
60layout-add lIT @europe rIT root 8.93 -6055.26 -1626.86
61layout-add lFR @europe rFR root 7.94 -4694.70 -1092.92
62layout-add lDE @europe rDE root 8.20 -5367.29 -727.28
63layout-add lES @europe rES root 9.93 -5558.99 -2243.35
Simon Huntb3656d42017-04-07 18:15:35 -070064
65# -- layouts for country sub-regions
Simon Huntc4ca7102017-04-08 22:28:04 -070066layout-add lMilan +segmentRoutingTwo rMilan lIT 0.86 68.58 54.71
Simon Huntb3656d42017-04-07 18:15:35 -070067
68# -- summary of installed layouts
69layouts
Simon Huntb3656d42017-04-07 18:15:35 -070070EOF
71
Simon Huntb3567282017-04-07 22:59:28 -070072###------------------------------------------------------
73### Add devices, hosts and links for each of the regions
74
75onos ${host} <<-EOF
76
77# -- UK devices
78
79null-create-device switch London ${nports} 51.5073 -0.1276
80null-create-device switch Reading ${nports} 51.4543 -0.9781
81null-create-device switch Portsmouth ${nports} 50.8198 -1.0880
82null-create-device switch Bristol ${nports} 51.4545 -2.5879
83null-create-device switch Warrington ${nports} 53.3900 -2.5970
84null-create-device switch Leeds ${nports} 53.8008 -1.5491
85
86# -- Assign UK devices to UK region
87
88region-add-devices rUK \
89 null:0000000000000001 \
90 null:0000000000000002 \
91 null:0000000000000003 \
92 null:0000000000000004 \
93 null:0000000000000005 \
94 null:0000000000000006 \
95
96# -- UK hosts
97
98null-create-host London 192.168.1.1 51.8697 -0.0287
99null-create-host London 192.168.1.2 51.7225 0.7624
100null-create-host London 192.168.1.3 51.1437 0.4694
101
102null-create-host Bristol 192.168.1.4 51.7500 -2.6000
103
104# -- UK connectivity
105
106null-create-link direct London Reading
107null-create-link direct London Portsmouth
108null-create-link direct Reading Bristol
109null-create-link direct Portsmouth Bristol
110null-create-link direct Reading Warrington
111null-create-link direct London Leeds
112null-create-link direct Leeds Warrington
113
114# -- UK Peers
Simon Huntc4ca7102017-04-08 22:28:04 -0700115region-add-peer-loc rUK rES 50.4060 -3.3860
116region-add-peer-loc rUK rFR 50.4060 -1.8482
117region-add-peer-loc rUK rIT 50.4060 -0.1361
118region-add-peer-loc rUK rDE 50.4060 1.2491
Simon Huntb3567282017-04-07 22:59:28 -0700119
120
121# -- France Devices
122
123null-create-device switch Paris ${nports} 48.8566 2.3522
124null-create-device switch Lyon ${nports} 45.7640 4.8357
125null-create-device switch Bordeaux ${nports} 44.8378 -0.5792
126null-create-device switch Marseille ${nports} 43.2965 5.3698
127null-create-device switch Nice ${nports} 43.7102 7.2620
128
129# -- Assign France devices to France region
130
131region-add-devices rFR \
132 null:0000000000000007 \
133 null:0000000000000008 \
134 null:0000000000000009 \
135 null:000000000000000a \
136 null:000000000000000b \
137
138
139# -- France hosts
140
141null-create-host Paris 192.168.2.1 49.5134 2.8882
142null-create-host Lyon 192.168.2.2 46.4590 5.2380
143
144# -- France connectivity
145
146null-create-link direct Paris Lyon
147null-create-link direct Paris Bordeaux
148null-create-link direct Lyon Bordeaux
149null-create-link direct Marseille Bordeaux
150null-create-link direct Marseille Lyon
151null-create-link direct Marseille Nice
152null-create-link direct Lyon Nice
153
154# -- France Peers
155
Simon Huntc4ca7102017-04-08 22:28:04 -0700156region-add-peer-loc rFR rES 42.6806 -2.1273
157region-add-peer-loc rFR rUK 50.6164 -2.1013
158region-add-peer-loc rFR rIT 45.1105 9.7450
159region-add-peer-loc rFR rDE 49.6307 7.9326
160
161
162# -- Italy Devices
163
164# these four in a mini fabric (data center?)
165
166null-create-device switch Milan-1 ${nports} 10.0 20.0 grid
167null-create-device switch Milan-2 ${nports} 10.0 50.0 grid
168null-create-device switch Milan-3 ${nports} 45.0 20.0 grid
169null-create-device switch Milan-4 ${nports} 45.0 50.0 grid
170
171null-create-host Milan-3 192.168.3.13 60.0 15.0 grid
172null-create-host Milan-4 192.168.3.14 60.0 45.0 grid
173
174region-add-devices rMilan \
175 null:000000000000000c \
176 null:000000000000000d \
177 null:000000000000000e \
178 null:000000000000000f \
179
180null-create-device switch Venice ${nports} 45.4408 12.3155
181null-create-device switch Rome ${nports} 41.9028 12.4964
182null-create-device switch Naples ${nports} 40.8518 14.2681
183
184region-add-devices rIT \
185 null:0000000000000010 \
186 null:0000000000000011 \
187 null:0000000000000012 \
188
189# -- Italy Connectivity
190
191null-create-link direct Milan-1 Milan-3
192null-create-link direct Milan-1 Milan-4
193null-create-link direct Milan-2 Milan-3
194null-create-link direct Milan-2 Milan-4
195
196null-create-link direct Milan-1 Venice
197null-create-link direct Milan-2 Rome
198
199null-create-link direct Venice Rome
200null-create-link direct Venice Naples
201null-create-link direct Rome Naples
202
203# -- Italy Peers
204
Simon Hunt0d7bbfc2017-06-04 10:51:47 -0700205region-add-peer-loc rIT rES 41.8942 2.7590
206region-add-peer-loc rIT rUK 47.0678 6.3919
207region-add-peer-loc rIT rFR 43.9538 5.1235
208region-add-peer-loc rIT rDE 47.3839 10.9857
Simon Huntc4ca7102017-04-08 22:28:04 -0700209
210# -- Germany Devices
211
212null-create-device switch Munich ${nports} 48.1351 11.5820
213null-create-device switch Berlin ${nports} 52.5200 13.4050
214null-create-device switch Bremen ${nports} 53.0793 8.8017
215null-create-device switch Frankfurt ${nports} 50.1109 8.6821
216null-create-device switch Stuttgart ${nports} 48.7758 9.1829
217
218null-create-host Munich 192.168.4.1 47.4818 11.7441
219null-create-host Berlin 192.168.4.2 53.0537 13.5310
220
221region-add-devices rDE \
222 null:0000000000000013 \
223 null:0000000000000014 \
224 null:0000000000000015 \
225 null:0000000000000016 \
226 null:0000000000000017 \
227
228# -- Germany Connectivity
229
230null-create-link direct Munich Berlin
231null-create-link direct Munich Stuttgart
232null-create-link direct Munich Stuttgart
233null-create-link direct Frankfurt Stuttgart
234null-create-link direct Frankfurt Bremen
235null-create-link direct Berlin Bremen
236null-create-link direct Berlin Frankfurt
237
238# -- Germany Peers
239
Simon Hunt0d7bbfc2017-06-04 10:51:47 -0700240region-add-peer-loc rDE rES 46.9845 2.1152
241region-add-peer-loc rDE rUK 51.6325 -0.1912
242region-add-peer-loc rDE rFR 48.5239 4.9598
243region-add-peer-loc rDE rIT 46.9118 11.1705
Simon Huntc4ca7102017-04-08 22:28:04 -0700244
245# -- Spain Devices
246
247null-create-device switch Madrid ${nports} 40.4168 -3.7038
248null-create-device switch Barcelona ${nports} 41.3851 2.1734
249null-create-device switch Valencia ${nports} 39.4699 -0.3763
250null-create-device switch Seville ${nports} 37.3891 -5.9845
251
252null-create-host Madrid 192.168.5.1 41.0797 -3.9559
253null-create-host Barcelona 192.168.5.2 41.8507 2.0399
254null-create-host Valencia 192.168.5.3 38.8488 -0.5097
255null-create-host Seville 192.168.5.4 38.0110 -6.4442
256
257region-add-devices rES \
258 null:0000000000000018 \
259 null:0000000000000019 \
260 null:000000000000001a \
261 null:000000000000001b \
262
263# -- Spain Connectivity
264
265null-create-link direct Barcelona Madrid
266null-create-link direct Barcelona Valencia
267null-create-link direct Seville Madrid
268null-create-link direct Seville Valencia
269null-create-link direct Madrid Valencia
270
271# -- Spain Peers
272
Simon Hunt0d7bbfc2017-06-04 10:51:47 -0700273region-add-peer-loc rES rDE 43.0897 2.4361
274region-add-peer-loc rES rUK 44.0273 -6.4832
275region-add-peer-loc rES rFR 43.5896 -0.7197
276region-add-peer-loc rES rIT 39.8093 4.8966
Simon Huntc4ca7102017-04-08 22:28:04 -0700277
278
279# -- Inter-Region Connectivity
280
281# Spain-France
282null-create-link direct Barcelona Marseille
283null-create-link direct Madrid Bordeaux
284
285# France-Italy
286null-create-link direct Rome Nice
287null-create-link direct Milan-1 Lyon
288
289# Italy-Germany
290null-create-link direct Venice Munich
291
292# France-Germany
293null-create-link direct Lyon Stuttgart
294null-create-link direct Paris Frankfurt
295
296# England-France
297null-create-link direct Portsmouth Paris
298
299# England-Germany
300null-create-link direct London Bremen
301null-create-link direct London Frankfurt
Simon Huntb3567282017-04-07 22:59:28 -0700302
303EOF
Simon Huntb3656d42017-04-07 18:15:35 -0700304
305### Set up debug log messages for classes we care about
306onos ${host} <<-EOF
307log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
308log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier
309log:set DEBUG org.onosproject.ui.impl.UiWebSocket
310log:set DEBUG org.onosproject.ui.impl.UiTopoSession
311log:list
312EOF