blob: 513566ce888288745112f8678e2831f2b3e9b0ef [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
101# -- GW devices
102
103null-create-device switch Wonju ${nports} 37.3422190 127.9201620
104null-create-device switch Chuncheon ${nports} 37.8813150 127.7299710
105null-create-device switch Gangneung ${nports} 37.7518530 128.8760570
106
107# -- Assign GW devices to GW region
108
109region-add-devices rGW \
110 null:0000000000000007 \
111 null:0000000000000008 \
112 null:0000000000000009 \
113
114# -- GW connectivity
115
116null-create-link direct Wonju Chuncheon
117null-create-link direct Wonju Gangneung
118null-create-link direct Gangneung Chuncheon
119
120# -- CC devices
121
122null-create-device switch Daejeon ${nports} 36.3504120 127.3845480
123null-create-device switch Cheongju ${nports} 36.6424340 127.4890320
124null-create-device switch Asan ${nports} 36.7897960 127.0018490
125null-create-device switch Chungju ${nports} 36.9910110 127.9259500
126
127# -- Assign CC devices to CC region
128
129region-add-devices rCC \
130 null:000000000000000a \
131 null:000000000000000b \
132 null:000000000000000c \
133 null:000000000000000d \
134
135# -- CC connectivity
136
137null-create-link direct Daejeon Cheongju
138null-create-link direct Daejeon Asan
139null-create-link direct Daejeon Chungju
140null-create-link direct Chungju Cheongju
141null-create-link direct Asan Cheongju
142
143# -- GS devices
144
145null-create-device switch Busan ${nports} 35.1795540 129.0756420
146null-create-device switch Daegu ${nports} 35.8714350 128.6014450
147null-create-device switch Ulsan ${nports} 35.5383770 129.3113600
148null-create-device switch Pohang ${nports} 36.0190180 129.3434810
149
150# -- Assign GS devices to GS region
151
152region-add-devices rGS \
153 null:000000000000000e \
154 null:000000000000000f \
155 null:0000000000000010 \
156 null:0000000000000011 \
157
158# -- GS connectivity
159
160null-create-link direct Busan Daegu
161null-create-link direct Busan Ulsan
162null-create-link direct Busan Pohang
163null-create-link direct Daegu Pohang
164null-create-link direct Pohang Ulsan
165
166# -- JL devices
167
168null-create-device switch Gwangju ${nports} 35.1595450 126.8526010
169null-create-device switch Jeonju ${nports} 35.8242240 127.1479530
170null-create-device switch Iksan ${nports} 35.9482860 126.9575990
171null-create-device switch Yeosu ${nports} 34.7603740 127.6622220
172null-create-device switch Suncheon ${nports} 34.9506370 127.4872140
173
174# -- Assign JL devices to JL region
175
176region-add-devices rJL \
177 null:0000000000000012 \
178 null:0000000000000013 \
179 null:0000000000000014 \
180 null:0000000000000015 \
181 null:0000000000000016 \
182
183# -- JL connectivity
184
185null-create-link direct Gwangju Jeonju
186null-create-link direct Gwangju Iksan
187null-create-link direct Gwangju Yeosu
188null-create-link direct Gwangju Suncheon
189null-create-link direct Yeosu Suncheon
190null-create-link direct Jeonju Iksan
191null-create-link direct Jeonju Yeosu
192
193# -- JJ devices
194
195null-create-device switch Jeju ${nports} 33.4890110 126.4983020
196null-create-device switch Seogwipo ${nports} 33.2541210 126.5600760
197
198# -- Assign JJ devices to JJ region
199
200region-add-devices rJJ \
201 null:0000000000000017 \
202 null:0000000000000018 \
203
204# -- JJ connectivity
205
206null-create-link direct Jeju Seogwipo
207
208### Set up debug log messages for classes we care about
209onos ${host} <<-EOF
210log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
211log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier
212log:set DEBUG org.onosproject.ui.impl.UiWebSocket
213log:set DEBUG org.onosproject.ui.impl.UiTopoSession
214log:list
215EOF