blob: 58f2944d226d73f689ffd659f84b1c833cf5eeb6 [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 Huntb3567282017-04-07 22:59:28 -070031# region-add <region-id> <region-name> <region-type> <lat/Y> <long/X> <region-master>
Simon Huntb3656d42017-04-07 18:15:35 -070032
33onos ${host} <<-EOF
34
35region-add rUK "United Kingdom" COUNTRY 52.206035 -1.310384 ${host}
36region-add rIT "Italy" COUNTRY 44.447951 11.093161 ${host}
37region-add rFR "France" COUNTRY 47.066264 2.711458 ${host}
38region-add rDE "Germany" COUNTRY 50.863152 9.761971 ${host}
39region-add rES "Spain" COUNTRY 40.416704 -3.7035824 ${host}
40
Simon Huntc4ca7102017-04-08 22:28:04 -070041region-add rMilan "Milan" METRO 45.4654 9.1859 ${host}
42
Simon Huntb3656d42017-04-07 18:15:35 -070043EOF
44
45
46###------------------------------------------------------
Simon Huntb3656d42017-04-07 18:15:35 -070047### Add layouts, associating backing regions, and optional parent.
48# layout-add <layout-id> <bg-ref> \
49# [ <region-id> <parent-layout-id> <scale> <offset-x> <offset-y> ]
50#
51
52onos ${host} <<-EOF
53
54# -- root layout
Steven Burrows67713d42017-04-11 11:35:20 -070055layout-add root @europe . . 4.66 -2562.93 -412.56
Simon Huntb3656d42017-04-07 18:15:35 -070056
57# -- layouts for top level regions
Steven Burrows67713d42017-04-11 11:35:20 -070058layout-add lUK @europe rUK root 11.63 -6652.54 -938.04
59layout-add lIT @europe rIT root 7.15 -4818.73 -1330.36
60layout-add lFR @europe rFR root 8.98 -5378.99 -1334.77
61layout-add lDE @europe rDE root 10.06 -6739.05 -1002.4
62layout-add lES @europe rES root 10.34 -5804.84 -2464.81
Simon Huntb3656d42017-04-07 18:15:35 -070063
64# -- layouts for country sub-regions
Simon Huntc4ca7102017-04-08 22:28:04 -070065layout-add lMilan +segmentRoutingTwo rMilan lIT 0.86 68.58 54.71
Simon Huntb3656d42017-04-07 18:15:35 -070066
67# -- summary of installed layouts
68layouts
Simon Huntb3656d42017-04-07 18:15:35 -070069EOF
70
Simon Huntb3567282017-04-07 22:59:28 -070071###------------------------------------------------------
72### Add devices, hosts and links for each of the regions
73
74onos ${host} <<-EOF
75
76# -- UK devices
77
78null-create-device switch London ${nports} 51.5073 -0.1276
79null-create-device switch Reading ${nports} 51.4543 -0.9781
80null-create-device switch Portsmouth ${nports} 50.8198 -1.0880
81null-create-device switch Bristol ${nports} 51.4545 -2.5879
82null-create-device switch Warrington ${nports} 53.3900 -2.5970
83null-create-device switch Leeds ${nports} 53.8008 -1.5491
84
85# -- Assign UK devices to UK region
86
87region-add-devices rUK \
88 null:0000000000000001 \
89 null:0000000000000002 \
90 null:0000000000000003 \
91 null:0000000000000004 \
92 null:0000000000000005 \
93 null:0000000000000006 \
94
95# -- UK hosts
96
97null-create-host London 192.168.1.1 51.8697 -0.0287
98null-create-host London 192.168.1.2 51.7225 0.7624
99null-create-host London 192.168.1.3 51.1437 0.4694
100
101null-create-host Bristol 192.168.1.4 51.7500 -2.6000
102
103# -- UK connectivity
104
105null-create-link direct London Reading
106null-create-link direct London Portsmouth
107null-create-link direct Reading Bristol
108null-create-link direct Portsmouth Bristol
109null-create-link direct Reading Warrington
110null-create-link direct London Leeds
111null-create-link direct Leeds Warrington
112
113# -- UK Peers
Simon Huntc4ca7102017-04-08 22:28:04 -0700114region-add-peer-loc rUK rES 50.4060 -3.3860
115region-add-peer-loc rUK rFR 50.4060 -1.8482
116region-add-peer-loc rUK rIT 50.4060 -0.1361
117region-add-peer-loc rUK rDE 50.4060 1.2491
Simon Huntb3567282017-04-07 22:59:28 -0700118
119
120# -- France Devices
121
122null-create-device switch Paris ${nports} 48.8566 2.3522
123null-create-device switch Lyon ${nports} 45.7640 4.8357
124null-create-device switch Bordeaux ${nports} 44.8378 -0.5792
125null-create-device switch Marseille ${nports} 43.2965 5.3698
126null-create-device switch Nice ${nports} 43.7102 7.2620
127
128# -- Assign France devices to France region
129
130region-add-devices rFR \
131 null:0000000000000007 \
132 null:0000000000000008 \
133 null:0000000000000009 \
134 null:000000000000000a \
135 null:000000000000000b \
136
137
138# -- France hosts
139
140null-create-host Paris 192.168.2.1 49.5134 2.8882
141null-create-host Lyon 192.168.2.2 46.4590 5.2380
142
143# -- France connectivity
144
145null-create-link direct Paris Lyon
146null-create-link direct Paris Bordeaux
147null-create-link direct Lyon Bordeaux
148null-create-link direct Marseille Bordeaux
149null-create-link direct Marseille Lyon
150null-create-link direct Marseille Nice
151null-create-link direct Lyon Nice
152
153# -- France Peers
154
Simon Huntc4ca7102017-04-08 22:28:04 -0700155region-add-peer-loc rFR rES 42.6806 -2.1273
156region-add-peer-loc rFR rUK 50.6164 -2.1013
157region-add-peer-loc rFR rIT 45.1105 9.7450
158region-add-peer-loc rFR rDE 49.6307 7.9326
159
160
161# -- Italy Devices
162
163# these four in a mini fabric (data center?)
164
165null-create-device switch Milan-1 ${nports} 10.0 20.0 grid
166null-create-device switch Milan-2 ${nports} 10.0 50.0 grid
167null-create-device switch Milan-3 ${nports} 45.0 20.0 grid
168null-create-device switch Milan-4 ${nports} 45.0 50.0 grid
169
170null-create-host Milan-3 192.168.3.13 60.0 15.0 grid
171null-create-host Milan-4 192.168.3.14 60.0 45.0 grid
172
173region-add-devices rMilan \
174 null:000000000000000c \
175 null:000000000000000d \
176 null:000000000000000e \
177 null:000000000000000f \
178
179null-create-device switch Venice ${nports} 45.4408 12.3155
180null-create-device switch Rome ${nports} 41.9028 12.4964
181null-create-device switch Naples ${nports} 40.8518 14.2681
182
183region-add-devices rIT \
184 null:0000000000000010 \
185 null:0000000000000011 \
186 null:0000000000000012 \
187
188# -- Italy Connectivity
189
190null-create-link direct Milan-1 Milan-3
191null-create-link direct Milan-1 Milan-4
192null-create-link direct Milan-2 Milan-3
193null-create-link direct Milan-2 Milan-4
194
195null-create-link direct Milan-1 Venice
196null-create-link direct Milan-2 Rome
197
198null-create-link direct Venice Rome
199null-create-link direct Venice Naples
200null-create-link direct Rome Naples
201
202# -- Italy Peers
203
204#region-add-peer-loc rIT rES xx.xxxx xx.xxxx
205#region-add-peer-loc rIT rUK xx.xxxx xx.xxxx
206#region-add-peer-loc rIT rFR xx.xxxx xx.xxxx
207#region-add-peer-loc rIT rDE xx.xxxx xx.xxxx
208
209# -- Germany Devices
210
211null-create-device switch Munich ${nports} 48.1351 11.5820
212null-create-device switch Berlin ${nports} 52.5200 13.4050
213null-create-device switch Bremen ${nports} 53.0793 8.8017
214null-create-device switch Frankfurt ${nports} 50.1109 8.6821
215null-create-device switch Stuttgart ${nports} 48.7758 9.1829
216
217null-create-host Munich 192.168.4.1 47.4818 11.7441
218null-create-host Berlin 192.168.4.2 53.0537 13.5310
219
220region-add-devices rDE \
221 null:0000000000000013 \
222 null:0000000000000014 \
223 null:0000000000000015 \
224 null:0000000000000016 \
225 null:0000000000000017 \
226
227# -- Germany Connectivity
228
229null-create-link direct Munich Berlin
230null-create-link direct Munich Stuttgart
231null-create-link direct Munich Stuttgart
232null-create-link direct Frankfurt Stuttgart
233null-create-link direct Frankfurt Bremen
234null-create-link direct Berlin Bremen
235null-create-link direct Berlin Frankfurt
236
237# -- Germany Peers
238
239#region-add-peer-loc rDE rES xx.xxxx xx.xxxx
240#region-add-peer-loc rDE rUK xx.xxxx xx.xxxx
241#region-add-peer-loc rDE rFR xx.xxxx xx.xxxx
242#region-add-peer-loc rDE rIT xx.xxxx xx.xxxx
243
244# -- Spain Devices
245
246null-create-device switch Madrid ${nports} 40.4168 -3.7038
247null-create-device switch Barcelona ${nports} 41.3851 2.1734
248null-create-device switch Valencia ${nports} 39.4699 -0.3763
249null-create-device switch Seville ${nports} 37.3891 -5.9845
250
251null-create-host Madrid 192.168.5.1 41.0797 -3.9559
252null-create-host Barcelona 192.168.5.2 41.8507 2.0399
253null-create-host Valencia 192.168.5.3 38.8488 -0.5097
254null-create-host Seville 192.168.5.4 38.0110 -6.4442
255
256region-add-devices rES \
257 null:0000000000000018 \
258 null:0000000000000019 \
259 null:000000000000001a \
260 null:000000000000001b \
261
262# -- Spain Connectivity
263
264null-create-link direct Barcelona Madrid
265null-create-link direct Barcelona Valencia
266null-create-link direct Seville Madrid
267null-create-link direct Seville Valencia
268null-create-link direct Madrid Valencia
269
270# -- Spain Peers
271
272#region-add-peer-loc rES rDE xx.xxxx xx.xxxx
273#region-add-peer-loc rES rUK xx.xxxx xx.xxxx
274#region-add-peer-loc rES rFR xx.xxxx xx.xxxx
275#region-add-peer-loc rES rIT xx.xxxx xx.xxxx
276
277
278# -- Inter-Region Connectivity
279
280# Spain-France
281null-create-link direct Barcelona Marseille
282null-create-link direct Madrid Bordeaux
283
284# France-Italy
285null-create-link direct Rome Nice
286null-create-link direct Milan-1 Lyon
287
288# Italy-Germany
289null-create-link direct Venice Munich
290
291# France-Germany
292null-create-link direct Lyon Stuttgart
293null-create-link direct Paris Frankfurt
294
295# England-France
296null-create-link direct Portsmouth Paris
297
298# England-Germany
299null-create-link direct London Bremen
300null-create-link direct London Frankfurt
Simon Huntb3567282017-04-07 22:59:28 -0700301
302EOF
Simon Huntb3656d42017-04-07 18:15:35 -0700303
304### Set up debug log messages for classes we care about
305onos ${host} <<-EOF
306log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
307log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier
308log:set DEBUG org.onosproject.ui.impl.UiWebSocket
309log:set DEBUG org.onosproject.ui.impl.UiTopoSession
310log:list
311EOF