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