Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # A test topology of four data centers (spine-leaf fabrics), configured as |
| 4 | # four sub-regions, and positioned in the Bay Area (geographically speaking). |
| 5 | # |
| 6 | # Script Configuration: |
| 7 | # |
| 8 | # host : the controller instance against which this script is run |
| 9 | # nports : the number of ports to configure on each switch |
| 10 | # sleepfor : the number of seconds to wait for sim to restart |
| 11 | |
| 12 | host=${1:-127.0.0.1} |
| 13 | nports=16 |
| 14 | sleepfor=5 |
| 15 | |
| 16 | ### start up null provider |
| 17 | |
| 18 | onos ${host} null-simulation stop custom |
| 19 | onos ${host} wipe-out please |
| 20 | onos ${host} null-simulation start custom |
| 21 | |
| 22 | |
| 23 | ## unfortunately, it takes a time for the sim to start up |
| 24 | # this is not ideal... |
| 25 | |
| 26 | echo |
| 27 | echo "Sleeping while sim starts up... (${sleepfor} seconds)..." |
| 28 | echo |
| 29 | sleep ${sleepfor} |
| 30 | |
| 31 | |
| 32 | ### Add devices and links |
| 33 | # |
| 34 | # null-create-device <type> <name> <#ports> <latitude/Y> <longitude/X> [geo|grid] |
| 35 | # null-create-link <type> <src> <dst> |
| 36 | |
| 37 | onos ${host} <<-EOF |
| 38 | |
| 39 | # root region |
| 40 | |
| 41 | # CO 1 |
| 42 | null-create-device switch SPINE-A-1 ${nports} 10.0 20.0 grid |
| 43 | null-create-device switch SPINE-A-2 ${nports} 10.0 50.0 grid |
| 44 | null-create-device switch SPINE-A-3 ${nports} 10.0 80.0 grid |
| 45 | null-create-device switch SPINE-A-4 ${nports} 10.0 110.0 grid |
| 46 | |
| 47 | null-create-device switch LEAF-A-1 ${nports} 45.0 20.0 grid |
| 48 | null-create-device switch LEAF-A-2 ${nports} 45.0 50.0 grid |
| 49 | null-create-device switch LEAF-A-3 ${nports} 45.0 80.0 grid |
| 50 | null-create-device switch LEAF-A-4 ${nports} 45.0 110.0 grid |
| 51 | |
| 52 | # Links in CO 1 |
| 53 | null-create-link direct LEAF-A-1 SPINE-A-1 |
| 54 | null-create-link direct LEAF-A-1 SPINE-A-2 |
| 55 | null-create-link direct LEAF-A-1 SPINE-A-3 |
| 56 | null-create-link direct LEAF-A-1 SPINE-A-4 |
| 57 | |
| 58 | null-create-link direct LEAF-A-2 SPINE-A-1 |
| 59 | null-create-link direct LEAF-A-2 SPINE-A-2 |
| 60 | null-create-link direct LEAF-A-2 SPINE-A-3 |
| 61 | null-create-link direct LEAF-A-2 SPINE-A-4 |
| 62 | |
| 63 | null-create-link direct LEAF-A-3 SPINE-A-1 |
| 64 | null-create-link direct LEAF-A-3 SPINE-A-2 |
| 65 | null-create-link direct LEAF-A-3 SPINE-A-3 |
| 66 | null-create-link direct LEAF-A-3 SPINE-A-4 |
| 67 | |
| 68 | null-create-link direct LEAF-A-4 SPINE-A-1 |
| 69 | null-create-link direct LEAF-A-4 SPINE-A-2 |
| 70 | null-create-link direct LEAF-A-4 SPINE-A-3 |
| 71 | null-create-link direct LEAF-A-4 SPINE-A-4 |
| 72 | |
| 73 | # CO 2 |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 74 | null-create-device switch SPINE-B-1 ${nports} 10.0 20.0 grid |
| 75 | null-create-device switch SPINE-B-2 ${nports} 10.0 50.0 grid |
| 76 | null-create-device switch SPINE-B-3 ${nports} 10.0 80.0 grid |
| 77 | null-create-device switch SPINE-B-4 ${nports} 10.0 110.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 78 | |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 79 | null-create-device switch LEAF-B-1 ${nports} 45.0 20.0 grid |
| 80 | null-create-device switch LEAF-B-2 ${nports} 45.0 50.0 grid |
| 81 | null-create-device switch LEAF-B-3 ${nports} 45.0 80.0 grid |
| 82 | null-create-device switch LEAF-B-4 ${nports} 45.0 110.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 83 | |
| 84 | # Links in CO 2 |
| 85 | null-create-link direct LEAF-B-1 SPINE-B-1 |
| 86 | null-create-link direct LEAF-B-1 SPINE-B-2 |
| 87 | null-create-link direct LEAF-B-1 SPINE-B-3 |
| 88 | null-create-link direct LEAF-B-1 SPINE-B-4 |
| 89 | |
| 90 | null-create-link direct LEAF-B-2 SPINE-B-1 |
| 91 | null-create-link direct LEAF-B-2 SPINE-B-2 |
| 92 | null-create-link direct LEAF-B-2 SPINE-B-3 |
| 93 | null-create-link direct LEAF-B-2 SPINE-B-4 |
| 94 | |
| 95 | null-create-link direct LEAF-B-3 SPINE-B-1 |
| 96 | null-create-link direct LEAF-B-3 SPINE-B-2 |
| 97 | null-create-link direct LEAF-B-3 SPINE-B-3 |
| 98 | null-create-link direct LEAF-B-3 SPINE-B-4 |
| 99 | |
| 100 | null-create-link direct LEAF-B-4 SPINE-B-1 |
| 101 | null-create-link direct LEAF-B-4 SPINE-B-2 |
| 102 | null-create-link direct LEAF-B-4 SPINE-B-3 |
| 103 | null-create-link direct LEAF-B-4 SPINE-B-4 |
| 104 | |
| 105 | # CO 3 |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 106 | null-create-device switch SPINE-C-1 ${nports} 10.0 20.0 grid |
| 107 | null-create-device switch SPINE-C-2 ${nports} 10.0 50.0 grid |
| 108 | null-create-device switch SPINE-C-3 ${nports} 10.0 80.0 grid |
| 109 | null-create-device switch SPINE-C-4 ${nports} 10.0 110.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 110 | |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 111 | null-create-device switch LEAF-C-1 ${nports} 45.0 20.0 grid |
| 112 | null-create-device switch LEAF-C-2 ${nports} 45.0 50.0 grid |
| 113 | null-create-device switch LEAF-C-3 ${nports} 45.0 80.0 grid |
| 114 | null-create-device switch LEAF-C-4 ${nports} 45.0 110.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 115 | |
| 116 | # Links in CO 3 |
| 117 | null-create-link direct LEAF-C-1 SPINE-C-1 |
| 118 | null-create-link direct LEAF-C-1 SPINE-C-2 |
| 119 | null-create-link direct LEAF-C-1 SPINE-C-3 |
| 120 | null-create-link direct LEAF-C-1 SPINE-C-4 |
| 121 | |
| 122 | null-create-link direct LEAF-C-2 SPINE-C-1 |
| 123 | null-create-link direct LEAF-C-2 SPINE-C-2 |
| 124 | null-create-link direct LEAF-C-2 SPINE-C-3 |
| 125 | null-create-link direct LEAF-C-2 SPINE-C-4 |
| 126 | |
| 127 | null-create-link direct LEAF-C-3 SPINE-C-1 |
| 128 | null-create-link direct LEAF-C-3 SPINE-C-2 |
| 129 | null-create-link direct LEAF-C-3 SPINE-C-3 |
| 130 | null-create-link direct LEAF-C-3 SPINE-C-4 |
| 131 | |
| 132 | null-create-link direct LEAF-C-4 SPINE-C-1 |
| 133 | null-create-link direct LEAF-C-4 SPINE-C-2 |
| 134 | null-create-link direct LEAF-C-4 SPINE-C-3 |
| 135 | null-create-link direct LEAF-C-4 SPINE-C-4 |
| 136 | |
| 137 | # CO 4 |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 138 | null-create-device switch SPINE-D-1 ${nports} 10.0 20.0 grid |
| 139 | null-create-device switch SPINE-D-2 ${nports} 10.0 50.0 grid |
| 140 | null-create-device switch SPINE-D-3 ${nports} 10.0 80.0 grid |
| 141 | null-create-device switch SPINE-D-4 ${nports} 10.0 110.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 142 | |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 143 | null-create-device switch LEAF-D-1 ${nports} 45.0 20.0 grid |
| 144 | null-create-device switch LEAF-D-2 ${nports} 45.0 50.0 grid |
| 145 | null-create-device switch LEAF-D-3 ${nports} 45.0 80.0 grid |
| 146 | null-create-device switch LEAF-D-4 ${nports} 45.0 110.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 147 | |
| 148 | # Links in CO 4 |
| 149 | null-create-link direct LEAF-D-1 SPINE-D-1 |
| 150 | null-create-link direct LEAF-D-1 SPINE-D-2 |
| 151 | null-create-link direct LEAF-D-1 SPINE-D-3 |
| 152 | null-create-link direct LEAF-D-1 SPINE-D-4 |
| 153 | |
| 154 | null-create-link direct LEAF-D-2 SPINE-D-1 |
| 155 | null-create-link direct LEAF-D-2 SPINE-D-2 |
| 156 | null-create-link direct LEAF-D-2 SPINE-D-3 |
| 157 | null-create-link direct LEAF-D-2 SPINE-D-4 |
| 158 | |
| 159 | null-create-link direct LEAF-D-3 SPINE-D-1 |
| 160 | null-create-link direct LEAF-D-3 SPINE-D-2 |
| 161 | null-create-link direct LEAF-D-3 SPINE-D-3 |
| 162 | null-create-link direct LEAF-D-3 SPINE-D-4 |
| 163 | |
| 164 | null-create-link direct LEAF-D-4 SPINE-D-1 |
| 165 | null-create-link direct LEAF-D-4 SPINE-D-2 |
| 166 | null-create-link direct LEAF-D-4 SPINE-D-3 |
| 167 | null-create-link direct LEAF-D-4 SPINE-D-4 |
| 168 | |
| 169 | # Inter-CO Links |
| 170 | null-create-link direct LEAF-A-4 LEAF-B-1 |
| 171 | null-create-link direct LEAF-A-4 LEAF-C-1 |
| 172 | null-create-link direct LEAF-A-4 LEAF-D-4 |
| 173 | null-create-link direct LEAF-B-1 LEAF-C-1 |
| 174 | null-create-link direct LEAF-B-1 LEAF-D-4 |
| 175 | null-create-link direct LEAF-C-1 LEAF-D-4 |
| 176 | |
| 177 | EOF |
| 178 | |
| 179 | ### Add a host per device |
| 180 | # |
| 181 | # null-create-host <device-id> <host-ip> <latitude/Y> <longitude/X> [geo|grid] |
| 182 | |
| 183 | onos ${host} <<-EOF |
| 184 | |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 185 | null-create-host LEAF-A-1 192.168.1.1 60.0 15.0 grid |
| 186 | null-create-host LEAF-A-2 192.168.2.1 60.0 45.0 grid |
| 187 | null-create-host LEAF-A-3 192.168.3.1 60.0 85.0 grid |
| 188 | null-create-host LEAF-A-4 192.168.4.1 60.0 115.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 189 | |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 190 | null-create-host LEAF-B-1 192.168.51.1 60.0 15.0 grid |
| 191 | null-create-host LEAF-B-2 192.168.52.1 60.0 45.0 grid |
| 192 | null-create-host LEAF-B-3 192.168.53.1 60.0 85.0 grid |
| 193 | null-create-host LEAF-B-4 192.168.54.1 60.0 115.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 194 | |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 195 | null-create-host LEAF-C-1 192.168.101.1 60.0 15.0 grid |
| 196 | null-create-host LEAF-C-2 192.168.102.1 60.0 45.0 grid |
| 197 | null-create-host LEAF-C-3 192.168.103.1 60.0 85.0 grid |
| 198 | null-create-host LEAF-C-4 192.168.104.1 60.0 115.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 199 | |
Simon Hunt | 5b4d665 | 2017-02-27 10:56:00 -0800 | [diff] [blame] | 200 | null-create-host LEAF-D-1 192.168.151.1 60.0 15.0 grid |
| 201 | null-create-host LEAF-D-2 192.168.152.1 60.0 45.0 grid |
| 202 | null-create-host LEAF-D-3 192.168.153.1 60.0 85.0 grid |
| 203 | null-create-host LEAF-D-4 192.168.154.1 60.0 115.0 grid |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 204 | |
| 205 | EOF |
| 206 | |
| 207 | ### Add regions and associate devices with them |
| 208 | # |
| 209 | # region-add <region-id> <region-name> <region-type> <region-master> |
| 210 | # region-add-devices <region-id> <device-id>... |
| 211 | |
| 212 | onos ${host} <<-EOF |
| 213 | |
| 214 | region-add c01 SanFrancisco DATA_CENTER 37.75394143914288 -122.45945851660800 ${host} |
| 215 | region-add c02 PaloAlto DATA_CENTER 37.45466637790734 -122.21838933304870 ${host} |
| 216 | region-add c03 SanJose DATA_CENTER 37.34425619809433 -121.94768095808017 ${host} |
| 217 | region-add c04 Fremont DATA_CENTER 37.54328280574901 -122.01205548699211 ${host} |
| 218 | |
| 219 | region-add-devices c01 \ |
| 220 | null:0000000000000001 \ |
| 221 | null:0000000000000002 \ |
| 222 | null:0000000000000003 \ |
| 223 | null:0000000000000004 \ |
| 224 | null:0000000000000005 \ |
| 225 | null:0000000000000006 \ |
| 226 | null:0000000000000007 \ |
| 227 | null:0000000000000008 \ |
| 228 | |
| 229 | region-add-devices c02 \ |
| 230 | null:0000000000000009 \ |
| 231 | null:000000000000000a \ |
| 232 | null:000000000000000b \ |
| 233 | null:000000000000000c \ |
| 234 | null:000000000000000d \ |
| 235 | null:000000000000000e \ |
| 236 | null:000000000000000f \ |
| 237 | null:0000000000000010 \ |
| 238 | |
| 239 | region-add-devices c03 \ |
| 240 | null:0000000000000011 \ |
| 241 | null:0000000000000012 \ |
| 242 | null:0000000000000013 \ |
| 243 | null:0000000000000014 \ |
| 244 | null:0000000000000015 \ |
| 245 | null:0000000000000016 \ |
| 246 | null:0000000000000017 \ |
| 247 | null:0000000000000018 \ |
| 248 | |
| 249 | region-add-devices c04 \ |
| 250 | null:0000000000000019 \ |
| 251 | null:000000000000001a \ |
| 252 | null:000000000000001b \ |
| 253 | null:000000000000001c \ |
| 254 | null:000000000000001d \ |
| 255 | null:000000000000001e \ |
| 256 | null:000000000000001f \ |
| 257 | null:0000000000000020 \ |
| 258 | |
| 259 | regions |
| 260 | |
| 261 | EOF |
| 262 | |
| 263 | ### Add layouts, associating backing regions, and optional parent. |
| 264 | # |
Simon Hunt | ed81ed6 | 2017-03-21 17:53:38 -0700 | [diff] [blame] | 265 | # layout-add <layout-id> <bg-ref> \ |
| 266 | # [ <region-id> <parent-layout-id> <scale> <offset-x> <offset-y> ] |
| 267 | # |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 268 | |
| 269 | onos ${host} <<-EOF |
| 270 | |
Simon Hunt | f7e7d4a | 2017-03-24 15:22:20 -0700 | [diff] [blame] | 271 | layout-add root @bayareaGEO . . 4.5 0.0 0.0 |
Simon Hunt | e9717e6 | 2017-02-16 16:54:43 -0800 | [diff] [blame] | 272 | |
Simon Hunt | ed81ed6 | 2017-03-21 17:53:38 -0700 | [diff] [blame] | 273 | layout-add lC01 +segmentRouting c01 . 0.9 5.2 -4.0 |
Simon Hunt | e9717e6 | 2017-02-16 16:54:43 -0800 | [diff] [blame] | 274 | layout-add lC02 +segmentRouting c02 |
| 275 | layout-add lC03 +segmentRouting c03 |
| 276 | layout-add lC04 . c04 # testing no-background |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 277 | |
| 278 | layouts |
| 279 | |
| 280 | EOF |
| 281 | |
| 282 | |
| 283 | ### Set up debug log messages for classes we care about |
| 284 | |
| 285 | onos ${host} <<-EOF |
| 286 | |
| 287 | log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler |
| 288 | log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier |
| 289 | log:set DEBUG org.onosproject.ui.impl.UiWebSocket |
| 290 | log:set DEBUG org.onosproject.ui.impl.UiTopoSession |
| 291 | log:list |
| 292 | |
| 293 | EOF |