Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
Simon Hunt | b356728 | 2017-04-07 22:59:28 -0700 | [diff] [blame] | 3 | # Creates a Europe-based topology (with regions) using ONOS null provider |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 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... |
| 20 | |
| 21 | echo |
| 22 | echo "Sleeping while sim starts up... (${sleepfor} seconds)..." |
| 23 | echo |
| 24 | sleep ${sleepfor} |
| 25 | |
| 26 | |
Simon Hunt | b356728 | 2017-04-07 22:59:28 -0700 | [diff] [blame] | 27 | ###------------------------------------------------------ |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 28 | ### Start by adding Country regions |
| 29 | # Note that Long/Lat places region icon nicely in the country center |
| 30 | |
Simon Hunt | b356728 | 2017-04-07 22:59:28 -0700 | [diff] [blame] | 31 | # region-add <region-id> <region-name> <region-type> <lat/Y> <long/X> <region-master> |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 32 | |
| 33 | onos ${host} <<-EOF |
| 34 | |
| 35 | region-add rUK "United Kingdom" COUNTRY 52.206035 -1.310384 ${host} |
| 36 | region-add rIT "Italy" COUNTRY 44.447951 11.093161 ${host} |
| 37 | region-add rFR "France" COUNTRY 47.066264 2.711458 ${host} |
| 38 | region-add rDE "Germany" COUNTRY 50.863152 9.761971 ${host} |
| 39 | region-add rES "Spain" COUNTRY 40.416704 -3.7035824 ${host} |
| 40 | |
Simon Hunt | c4ca710 | 2017-04-08 22:28:04 -0700 | [diff] [blame] | 41 | region-add rMilan "Milan" METRO 45.4654 9.1859 ${host} |
| 42 | |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 43 | EOF |
| 44 | |
| 45 | |
| 46 | ###------------------------------------------------------ |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 47 | ### 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 | |
| 52 | onos ${host} <<-EOF |
| 53 | |
| 54 | # -- root layout |
Steven Burrows | 67713d4 | 2017-04-11 11:35:20 -0700 | [diff] [blame] | 55 | layout-add root @europe . . 4.66 -2562.93 -412.56 |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 56 | |
| 57 | # -- layouts for top level regions |
Steven Burrows | 67713d4 | 2017-04-11 11:35:20 -0700 | [diff] [blame] | 58 | layout-add lUK @europe rUK root 11.63 -6652.54 -938.04 |
| 59 | layout-add lIT @europe rIT root 7.15 -4818.73 -1330.36 |
| 60 | layout-add lFR @europe rFR root 8.98 -5378.99 -1334.77 |
| 61 | layout-add lDE @europe rDE root 10.06 -6739.05 -1002.4 |
| 62 | layout-add lES @europe rES root 10.34 -5804.84 -2464.81 |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 63 | |
| 64 | # -- layouts for country sub-regions |
Simon Hunt | c4ca710 | 2017-04-08 22:28:04 -0700 | [diff] [blame] | 65 | layout-add lMilan +segmentRoutingTwo rMilan lIT 0.86 68.58 54.71 |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 66 | |
| 67 | # -- summary of installed layouts |
| 68 | layouts |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 69 | EOF |
| 70 | |
Simon Hunt | b356728 | 2017-04-07 22:59:28 -0700 | [diff] [blame] | 71 | ###------------------------------------------------------ |
| 72 | ### Add devices, hosts and links for each of the regions |
| 73 | |
| 74 | onos ${host} <<-EOF |
| 75 | |
| 76 | # -- UK devices |
| 77 | |
| 78 | null-create-device switch London ${nports} 51.5073 -0.1276 |
| 79 | null-create-device switch Reading ${nports} 51.4543 -0.9781 |
| 80 | null-create-device switch Portsmouth ${nports} 50.8198 -1.0880 |
| 81 | null-create-device switch Bristol ${nports} 51.4545 -2.5879 |
| 82 | null-create-device switch Warrington ${nports} 53.3900 -2.5970 |
| 83 | null-create-device switch Leeds ${nports} 53.8008 -1.5491 |
| 84 | |
| 85 | # -- Assign UK devices to UK region |
| 86 | |
| 87 | region-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 | |
| 97 | null-create-host London 192.168.1.1 51.8697 -0.0287 |
| 98 | null-create-host London 192.168.1.2 51.7225 0.7624 |
| 99 | null-create-host London 192.168.1.3 51.1437 0.4694 |
| 100 | |
| 101 | null-create-host Bristol 192.168.1.4 51.7500 -2.6000 |
| 102 | |
| 103 | # -- UK connectivity |
| 104 | |
| 105 | null-create-link direct London Reading |
| 106 | null-create-link direct London Portsmouth |
| 107 | null-create-link direct Reading Bristol |
| 108 | null-create-link direct Portsmouth Bristol |
| 109 | null-create-link direct Reading Warrington |
| 110 | null-create-link direct London Leeds |
| 111 | null-create-link direct Leeds Warrington |
| 112 | |
| 113 | # -- UK Peers |
Simon Hunt | c4ca710 | 2017-04-08 22:28:04 -0700 | [diff] [blame] | 114 | ## TODO: figure out why this data isn't getting put into runtime config?! |
| 115 | region-add-peer-loc rUK rES 50.4060 -3.3860 |
| 116 | region-add-peer-loc rUK rFR 50.4060 -1.8482 |
| 117 | region-add-peer-loc rUK rIT 50.4060 -0.1361 |
| 118 | region-add-peer-loc rUK rDE 50.4060 1.2491 |
Simon Hunt | b356728 | 2017-04-07 22:59:28 -0700 | [diff] [blame] | 119 | |
| 120 | |
| 121 | # -- France Devices |
| 122 | |
| 123 | null-create-device switch Paris ${nports} 48.8566 2.3522 |
| 124 | null-create-device switch Lyon ${nports} 45.7640 4.8357 |
| 125 | null-create-device switch Bordeaux ${nports} 44.8378 -0.5792 |
| 126 | null-create-device switch Marseille ${nports} 43.2965 5.3698 |
| 127 | null-create-device switch Nice ${nports} 43.7102 7.2620 |
| 128 | |
| 129 | # -- Assign France devices to France region |
| 130 | |
| 131 | region-add-devices rFR \ |
| 132 | null:0000000000000007 \ |
| 133 | null:0000000000000008 \ |
| 134 | null:0000000000000009 \ |
| 135 | null:000000000000000a \ |
| 136 | null:000000000000000b \ |
| 137 | |
| 138 | |
| 139 | # -- France hosts |
| 140 | |
| 141 | null-create-host Paris 192.168.2.1 49.5134 2.8882 |
| 142 | null-create-host Lyon 192.168.2.2 46.4590 5.2380 |
| 143 | |
| 144 | # -- France connectivity |
| 145 | |
| 146 | null-create-link direct Paris Lyon |
| 147 | null-create-link direct Paris Bordeaux |
| 148 | null-create-link direct Lyon Bordeaux |
| 149 | null-create-link direct Marseille Bordeaux |
| 150 | null-create-link direct Marseille Lyon |
| 151 | null-create-link direct Marseille Nice |
| 152 | null-create-link direct Lyon Nice |
| 153 | |
| 154 | # -- France Peers |
| 155 | |
Simon Hunt | c4ca710 | 2017-04-08 22:28:04 -0700 | [diff] [blame] | 156 | region-add-peer-loc rFR rES 42.6806 -2.1273 |
| 157 | region-add-peer-loc rFR rUK 50.6164 -2.1013 |
| 158 | region-add-peer-loc rFR rIT 45.1105 9.7450 |
| 159 | region-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 | |
| 166 | null-create-device switch Milan-1 ${nports} 10.0 20.0 grid |
| 167 | null-create-device switch Milan-2 ${nports} 10.0 50.0 grid |
| 168 | null-create-device switch Milan-3 ${nports} 45.0 20.0 grid |
| 169 | null-create-device switch Milan-4 ${nports} 45.0 50.0 grid |
| 170 | |
| 171 | null-create-host Milan-3 192.168.3.13 60.0 15.0 grid |
| 172 | null-create-host Milan-4 192.168.3.14 60.0 45.0 grid |
| 173 | |
| 174 | region-add-devices rMilan \ |
| 175 | null:000000000000000c \ |
| 176 | null:000000000000000d \ |
| 177 | null:000000000000000e \ |
| 178 | null:000000000000000f \ |
| 179 | |
| 180 | null-create-device switch Venice ${nports} 45.4408 12.3155 |
| 181 | null-create-device switch Rome ${nports} 41.9028 12.4964 |
| 182 | null-create-device switch Naples ${nports} 40.8518 14.2681 |
| 183 | |
| 184 | region-add-devices rIT \ |
| 185 | null:0000000000000010 \ |
| 186 | null:0000000000000011 \ |
| 187 | null:0000000000000012 \ |
| 188 | |
| 189 | # -- Italy Connectivity |
| 190 | |
| 191 | null-create-link direct Milan-1 Milan-3 |
| 192 | null-create-link direct Milan-1 Milan-4 |
| 193 | null-create-link direct Milan-2 Milan-3 |
| 194 | null-create-link direct Milan-2 Milan-4 |
| 195 | |
| 196 | null-create-link direct Milan-1 Venice |
| 197 | null-create-link direct Milan-2 Rome |
| 198 | |
| 199 | null-create-link direct Venice Rome |
| 200 | null-create-link direct Venice Naples |
| 201 | null-create-link direct Rome Naples |
| 202 | |
| 203 | # -- Italy Peers |
| 204 | |
| 205 | #region-add-peer-loc rIT rES xx.xxxx xx.xxxx |
| 206 | #region-add-peer-loc rIT rUK xx.xxxx xx.xxxx |
| 207 | #region-add-peer-loc rIT rFR xx.xxxx xx.xxxx |
| 208 | #region-add-peer-loc rIT rDE xx.xxxx xx.xxxx |
| 209 | |
| 210 | # -- Germany Devices |
| 211 | |
| 212 | null-create-device switch Munich ${nports} 48.1351 11.5820 |
| 213 | null-create-device switch Berlin ${nports} 52.5200 13.4050 |
| 214 | null-create-device switch Bremen ${nports} 53.0793 8.8017 |
| 215 | null-create-device switch Frankfurt ${nports} 50.1109 8.6821 |
| 216 | null-create-device switch Stuttgart ${nports} 48.7758 9.1829 |
| 217 | |
| 218 | null-create-host Munich 192.168.4.1 47.4818 11.7441 |
| 219 | null-create-host Berlin 192.168.4.2 53.0537 13.5310 |
| 220 | |
| 221 | region-add-devices rDE \ |
| 222 | null:0000000000000013 \ |
| 223 | null:0000000000000014 \ |
| 224 | null:0000000000000015 \ |
| 225 | null:0000000000000016 \ |
| 226 | null:0000000000000017 \ |
| 227 | |
| 228 | # -- Germany Connectivity |
| 229 | |
| 230 | null-create-link direct Munich Berlin |
| 231 | null-create-link direct Munich Stuttgart |
| 232 | null-create-link direct Munich Stuttgart |
| 233 | null-create-link direct Frankfurt Stuttgart |
| 234 | null-create-link direct Frankfurt Bremen |
| 235 | null-create-link direct Berlin Bremen |
| 236 | null-create-link direct Berlin Frankfurt |
| 237 | |
| 238 | # -- Germany Peers |
| 239 | |
| 240 | #region-add-peer-loc rDE rES xx.xxxx xx.xxxx |
| 241 | #region-add-peer-loc rDE rUK xx.xxxx xx.xxxx |
| 242 | #region-add-peer-loc rDE rFR xx.xxxx xx.xxxx |
| 243 | #region-add-peer-loc rDE rIT xx.xxxx xx.xxxx |
| 244 | |
| 245 | # -- Spain Devices |
| 246 | |
| 247 | null-create-device switch Madrid ${nports} 40.4168 -3.7038 |
| 248 | null-create-device switch Barcelona ${nports} 41.3851 2.1734 |
| 249 | null-create-device switch Valencia ${nports} 39.4699 -0.3763 |
| 250 | null-create-device switch Seville ${nports} 37.3891 -5.9845 |
| 251 | |
| 252 | null-create-host Madrid 192.168.5.1 41.0797 -3.9559 |
| 253 | null-create-host Barcelona 192.168.5.2 41.8507 2.0399 |
| 254 | null-create-host Valencia 192.168.5.3 38.8488 -0.5097 |
| 255 | null-create-host Seville 192.168.5.4 38.0110 -6.4442 |
| 256 | |
| 257 | region-add-devices rES \ |
| 258 | null:0000000000000018 \ |
| 259 | null:0000000000000019 \ |
| 260 | null:000000000000001a \ |
| 261 | null:000000000000001b \ |
| 262 | |
| 263 | # -- Spain Connectivity |
| 264 | |
| 265 | null-create-link direct Barcelona Madrid |
| 266 | null-create-link direct Barcelona Valencia |
| 267 | null-create-link direct Seville Madrid |
| 268 | null-create-link direct Seville Valencia |
| 269 | null-create-link direct Madrid Valencia |
| 270 | |
| 271 | # -- Spain Peers |
| 272 | |
| 273 | #region-add-peer-loc rES rDE xx.xxxx xx.xxxx |
| 274 | #region-add-peer-loc rES rUK xx.xxxx xx.xxxx |
| 275 | #region-add-peer-loc rES rFR xx.xxxx xx.xxxx |
| 276 | #region-add-peer-loc rES rIT xx.xxxx xx.xxxx |
| 277 | |
| 278 | |
| 279 | # -- Inter-Region Connectivity |
| 280 | |
| 281 | # Spain-France |
| 282 | null-create-link direct Barcelona Marseille |
| 283 | null-create-link direct Madrid Bordeaux |
| 284 | |
| 285 | # France-Italy |
| 286 | null-create-link direct Rome Nice |
| 287 | null-create-link direct Milan-1 Lyon |
| 288 | |
| 289 | # Italy-Germany |
| 290 | null-create-link direct Venice Munich |
| 291 | |
| 292 | # France-Germany |
| 293 | null-create-link direct Lyon Stuttgart |
| 294 | null-create-link direct Paris Frankfurt |
| 295 | |
| 296 | # England-France |
| 297 | null-create-link direct Portsmouth Paris |
| 298 | |
| 299 | # England-Germany |
| 300 | null-create-link direct London Bremen |
| 301 | null-create-link direct London Frankfurt |
Simon Hunt | b356728 | 2017-04-07 22:59:28 -0700 | [diff] [blame] | 302 | |
| 303 | EOF |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 304 | |
| 305 | ### Set up debug log messages for classes we care about |
| 306 | onos ${host} <<-EOF |
| 307 | log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler |
| 308 | log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier |
| 309 | log:set DEBUG org.onosproject.ui.impl.UiWebSocket |
| 310 | log:set DEBUG org.onosproject.ui.impl.UiTopoSession |
| 311 | log:list |
| 312 | EOF |