blob: 1d94673c413936d62c94ca0c26d6e832adca5dc8 [file] [log] [blame]
Jian Lidc096732017-08-19 01:10:48 +09001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Creates a Korean-based topology (with regions) using ONOS null provider
4# -----------------------------------------------------------------------------
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
19# this is not ideal... but we'll live with it for now
20
21echo
22echo "Sleeping while sim starts up... (${sleepfor} seconds)..."
23echo
24sleep ${sleepfor}
25
26
27###------------------------------------------------------
28### Start by adding Country regions
29# Note that Long/Lat places region icon nicely in the country center
30
31# region-add <region-id> <region-name> <region-type> \
32# <lat/Y> <long/X> <locType> <region-master>
33
34onos ${host} <<-EOF
35
36region-add rGG "Gyeonggi-do" COUNTRY 37.4138000 127.5183000 geo ${host}
37region-add rGW "Gangwon-do" COUNTRY 37.8228000 128.1555000 geo ${host}
38region-add rCC "Chungcheng-do" COUNTRY 36.5622940 126.9541070 geo ${host}
39region-add rJL "Jeolla-do" COUNTRY 35.3564250 126.9541070 geo ${host}
40region-add rGS "Gyeongsang-do" COUNTRY 35.8059060 128.9876740 geo ${host}
41region-add rJJ "Jeju-do" COUNTRY 33.4890110 126.4983020 geo ${host}
42
43EOF
44
45###------------------------------------------------------
46### Add layouts, associating backing regions, and optional parent.
47# layout-add <layout-id> <bg-ref> \
48# [ <region-id> <parent-layout-id> <scale> <offset-x> <offset-y> ]
49#
50
51onos ${host} <<-EOF
52
53# -- root layout
54layout-add root @s_korea . . 1 0 -10
55
56# -- layouts for top level regions
57layout-add lGG @s_korea rGG root 5.480 -1582.5196 -770.0172
58layout-add lGW @s_korea rGW root 2.606 -1050.3955 -30.8123
59layout-add lCC @s_korea rCC root 3.083 -988.8076 -699.3067
60layout-add lJL @s_korea rJL root 2.747 -705.7564 -1211.7502
61layout-add lGS @s_korea rGS root 3.024 -1737.0638 -1231.4722
62layout-add lJJ @s_korea rJJ root 2.885 -496.0931 -2347.7142
63
64# -- summary of installed layouts
65layouts
66EOF
67
68###------------------------------------------------------
69### Add devices, hosts and links for each of the regions
70
71onos ${host} <<-EOF
72
73# -- GG devices
74
75null-create-device switch Seoul ${nports} 37.5665350 126.9779690
76null-create-device switch Incheon ${nports} 37.4562560 126.7052060
77null-create-device switch Suwon ${nports} 37.2635730 127.0286010
78null-create-device switch Goyang ${nports} 37.6583600 126.8320200
79null-create-device switch Yongin ${nports} 37.2410860 127.1775540
80null-create-device switch Seongnam ${nports} 37.4449170 127.1388680
81
82# -- Assign GG devices to GG region
83
84region-add-devices rGG \
85 null:0000000000000001 \
86 null:0000000000000002 \
87 null:0000000000000003 \
88 null:0000000000000004 \
89 null:0000000000000005 \
90 null:0000000000000006 \
91
92# -- GG connectivity
93
94null-create-link direct Seoul Suwon
95null-create-link direct Seoul Seongnam
96null-create-link direct Incheon Yongin
97null-create-link direct Incheon Goyang
98null-create-link direct Goyang Suwon
99null-create-link direct Seongnam Suwon
100
Simon Hunt1154a5a2017-09-06 19:26:04 -0700101# -- GG peers
102
103region-add-peer-loc rGG rGW 37.7252 127.6672
104region-add-peer-loc rGG rCC 37.0227 127.3566
105region-add-peer-loc rGG rGS 37.1117 127.7196
106region-add-peer-loc rGG rJL 36.9509 127.1277
107region-add-peer-loc rGG rJJ 36.9232 126.8540
108
109
Jian Lidc096732017-08-19 01:10:48 +0900110# -- GW devices
111
112null-create-device switch Wonju ${nports} 37.3422190 127.9201620
113null-create-device switch Chuncheon ${nports} 37.8813150 127.7299710
114null-create-device switch Gangneung ${nports} 37.7518530 128.8760570
115
116# -- Assign GW devices to GW region
117
118region-add-devices rGW \
119 null:0000000000000007 \
120 null:0000000000000008 \
121 null:0000000000000009 \
122
123# -- GW connectivity
124
125null-create-link direct Wonju Chuncheon
126null-create-link direct Wonju Gangneung
127null-create-link direct Gangneung Chuncheon
128
Simon Hunt1154a5a2017-09-06 19:26:04 -0700129# -- GW peers
130
131region-add-peer-loc rGW rGG 37.8043 127.0020
132region-add-peer-loc rGW rCC 36.8942 127.0999
133region-add-peer-loc rGW rGS 36.9275 129.1693
134region-add-peer-loc rGW rJL 36.8730 128.4439
135region-add-peer-loc rGW rJJ 36.7671 127.7459
136
137
Jian Lidc096732017-08-19 01:10:48 +0900138# -- CC devices
139
140null-create-device switch Daejeon ${nports} 36.3504120 127.3845480
141null-create-device switch Cheongju ${nports} 36.6424340 127.4890320
142null-create-device switch Asan ${nports} 36.7897960 127.0018490
143null-create-device switch Chungju ${nports} 36.9910110 127.9259500
144
145# -- Assign CC devices to CC region
146
147region-add-devices rCC \
148 null:000000000000000a \
149 null:000000000000000b \
150 null:000000000000000c \
151 null:000000000000000d \
152
153# -- CC connectivity
154
155null-create-link direct Daejeon Cheongju
156null-create-link direct Daejeon Asan
157null-create-link direct Daejeon Chungju
158null-create-link direct Chungju Cheongju
159null-create-link direct Asan Cheongju
160
Simon Hunt1154a5a2017-09-06 19:26:04 -0700161# -- CC peers
162
163region-add-peer-loc rCC rGW 37.2499 128.0815
164region-add-peer-loc rCC rGG 37.0604 127.2840
165region-add-peer-loc rCC rGS 36.9256 128.5413
166region-add-peer-loc rCC rJL 36.0471 127.2376
167region-add-peer-loc rCC rJJ 35.9449 127.0086
168
169
Jian Lidc096732017-08-19 01:10:48 +0900170# -- GS devices
171
172null-create-device switch Busan ${nports} 35.1795540 129.0756420
173null-create-device switch Daegu ${nports} 35.8714350 128.6014450
174null-create-device switch Ulsan ${nports} 35.5383770 129.3113600
175null-create-device switch Pohang ${nports} 36.0190180 129.3434810
176
177# -- Assign GS devices to GS region
178
179region-add-devices rGS \
180 null:000000000000000e \
181 null:000000000000000f \
182 null:0000000000000010 \
183 null:0000000000000011 \
184
185# -- GS connectivity
186
187null-create-link direct Busan Daegu
188null-create-link direct Busan Ulsan
189null-create-link direct Busan Pohang
190null-create-link direct Daegu Pohang
191null-create-link direct Pohang Ulsan
192
Simon Hunt1154a5a2017-09-06 19:26:04 -0700193# -- GS peers
194
195region-add-peer-loc rGS rGG 36.1994 127.9788
196region-add-peer-loc rGS rGW 36.1775 128.7119
197region-add-peer-loc rGS rCC 35.9361 127.6306
198region-add-peer-loc rGS rJL 35.0274 127.4704
199region-add-peer-loc rGS rJJ 34.7682 128.0892
200
201
Jian Lidc096732017-08-19 01:10:48 +0900202# -- JL devices
203
204null-create-device switch Gwangju ${nports} 35.1595450 126.8526010
205null-create-device switch Jeonju ${nports} 35.8242240 127.1479530
206null-create-device switch Iksan ${nports} 35.9482860 126.9575990
207null-create-device switch Yeosu ${nports} 34.7603740 127.6622220
208null-create-device switch Suncheon ${nports} 34.9506370 127.4872140
209
210# -- Assign JL devices to JL region
211
212region-add-devices rJL \
213 null:0000000000000012 \
214 null:0000000000000013 \
215 null:0000000000000014 \
216 null:0000000000000015 \
217 null:0000000000000016 \
218
219# -- JL connectivity
220
221null-create-link direct Gwangju Jeonju
222null-create-link direct Gwangju Iksan
223null-create-link direct Gwangju Yeosu
224null-create-link direct Gwangju Suncheon
225null-create-link direct Yeosu Suncheon
226null-create-link direct Jeonju Iksan
227null-create-link direct Jeonju Yeosu
228
Simon Hunt1154a5a2017-09-06 19:26:04 -0700229# -- JL peers
230
231region-add-peer-loc rJL rCC 36.0736 126.7974
232region-add-peer-loc rJL rGG 36.1204 127.3223
233region-add-peer-loc rJL rGW 36.0254 127.8910
234region-add-peer-loc rJL rGS 35.5403 127.8257
235region-add-peer-loc rJL rJJ 34.5884 127.1328
236
237# {"lng":9731256818,"lat":4647468107}}}
238
Jian Lidc096732017-08-19 01:10:48 +0900239# -- JJ devices
240
241null-create-device switch Jeju ${nports} 33.4890110 126.4983020
242null-create-device switch Seogwipo ${nports} 33.2541210 126.5600760
243
244# -- Assign JJ devices to JJ region
245
246region-add-devices rJJ \
247 null:0000000000000017 \
248 null:0000000000000018 \
249
250# -- JJ connectivity
251
252null-create-link direct Jeju Seogwipo
253
Simon Hunt1154a5a2017-09-06 19:26:04 -0700254# -- JJ peers
255
256region-add-peer-loc rJJ rGW 34.0295 126.8138
257region-add-peer-loc rJJ rGG 33.9136 126.6015
258region-add-peer-loc rJJ rCC 33.7931 126.4294
259region-add-peer-loc rJJ rGS 33.6874 127.0029
260region-add-peer-loc rJJ rJL 33.6607 126.3719
261
262
Jian Lidc096732017-08-19 01:10:48 +0900263### Set up debug log messages for classes we care about
264onos ${host} <<-EOF
265log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
266log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier
267log:set DEBUG org.onosproject.ui.impl.UiWebSocket
268log:set DEBUG org.onosproject.ui.impl.UiTopoSession
269log:list
270EOF