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 |
| 74 | null-create-device switch SPINE-B-1 ${nports} 37.458236 -122.252604 |
| 75 | null-create-device switch SPINE-B-2 ${nports} 37.458236 -122.212604 |
| 76 | null-create-device switch SPINE-B-3 ${nports} 37.458236 -122.172604 |
| 77 | null-create-device switch SPINE-B-4 ${nports} 37.458236 -122.132604 |
| 78 | |
| 79 | null-create-device switch LEAF-B-1 ${nports} 37.418236 -122.252604 |
| 80 | null-create-device switch LEAF-B-2 ${nports} 37.418236 -122.212604 |
| 81 | null-create-device switch LEAF-B-3 ${nports} 37.418236 -122.172604 |
| 82 | null-create-device switch LEAF-B-4 ${nports} 37.418236 -122.132604 |
| 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 |
| 106 | null-create-device switch SPINE-C-1 ${nports} 37.338208 -121.926329 |
| 107 | null-create-device switch SPINE-C-2 ${nports} 37.338208 -121.886329 |
| 108 | null-create-device switch SPINE-C-3 ${nports} 37.338208 -121.846329 |
| 109 | null-create-device switch SPINE-C-4 ${nports} 37.338208 -121.806329 |
| 110 | |
| 111 | null-create-device switch LEAF-C-1 ${nports} 37.298208 -121.926329 |
| 112 | null-create-device switch LEAF-C-2 ${nports} 37.298208 -121.886329 |
| 113 | null-create-device switch LEAF-C-3 ${nports} 37.298208 -121.846329 |
| 114 | null-create-device switch LEAF-C-4 ${nports} 37.298208 -121.806329 |
| 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 |
| 138 | null-create-device switch SPINE-D-1 ${nports} 37.556826 -122.051926 |
| 139 | null-create-device switch SPINE-D-2 ${nports} 37.556826 -122.011926 |
| 140 | null-create-device switch SPINE-D-3 ${nports} 37.556826 -121.971926 |
| 141 | null-create-device switch SPINE-D-4 ${nports} 37.556826 -121.931926 |
| 142 | |
| 143 | null-create-device switch LEAF-D-1 ${nports} 37.516826 -122.051926 |
| 144 | null-create-device switch LEAF-D-2 ${nports} 37.516826 -122.011926 |
| 145 | null-create-device switch LEAF-D-3 ${nports} 37.516826 -121.971926 |
| 146 | null-create-device switch LEAF-D-4 ${nports} 37.516826 -121.931926 |
| 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 | |
| 185 | null-create-host LEAF-A-1 192.168.1.1 60.0 20.0 grid |
| 186 | null-create-host LEAF-A-2 192.168.2.1 60.0 50.0 grid |
| 187 | null-create-host LEAF-A-3 192.168.3.1 60.0 80.0 grid |
| 188 | null-create-host LEAF-A-4 192.168.4.1 60.0 110.0 grid |
| 189 | |
| 190 | null-create-host LEAF-B-1 192.168.51.1 37.388236 -122.252604 |
| 191 | null-create-host LEAF-B-2 192.168.52.1 37.388236 -122.212604 |
| 192 | null-create-host LEAF-B-3 192.168.53.1 37.388236 -122.172604 |
| 193 | null-create-host LEAF-B-4 192.168.54.1 37.388236 -122.132604 |
| 194 | |
| 195 | null-create-host LEAF-C-1 192.168.101.1 37.268208 -121.926329 |
| 196 | null-create-host LEAF-C-2 192.168.102.1 37.268208 -121.886329 |
| 197 | null-create-host LEAF-C-3 192.168.103.1 37.268208 -121.846329 |
| 198 | null-create-host LEAF-C-4 192.168.104.1 37.268208 -121.806329 |
| 199 | |
| 200 | null-create-host LEAF-D-1 192.168.151.1 37.476826 -122.051926 |
| 201 | null-create-host LEAF-D-2 192.168.152.1 37.476826 -122.011926 |
| 202 | null-create-host LEAF-D-3 192.168.153.1 37.476826 -121.971926 |
| 203 | null-create-host LEAF-D-4 192.168.154.1 37.476826 -121.931926 |
| 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 | bc30e68 | 2017-02-15 18:39:23 -0800 | [diff] [blame] | 265 | # layout-add <layout-id> <bg-ref> <region-id(opt)> <parent-layout-id(opt)> |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 266 | |
| 267 | onos ${host} <<-EOF |
| 268 | |
Simon Hunt | e9717e6 | 2017-02-16 16:54:43 -0800 | [diff] [blame] | 269 | layout-add root @bayareaGEO |
| 270 | |
Simon Hunt | bc30e68 | 2017-02-15 18:39:23 -0800 | [diff] [blame] | 271 | layout-add lC01 +segmentRouting c01 |
Simon Hunt | e9717e6 | 2017-02-16 16:54:43 -0800 | [diff] [blame] | 272 | layout-add lC02 +segmentRouting c02 |
| 273 | layout-add lC03 +segmentRouting c03 |
| 274 | layout-add lC04 . c04 # testing no-background |
Simon Hunt | eb3cf54 | 2017-02-10 13:18:41 -0800 | [diff] [blame] | 275 | |
| 276 | layouts |
| 277 | |
| 278 | EOF |
| 279 | |
| 280 | |
| 281 | ### Set up debug log messages for classes we care about |
| 282 | |
| 283 | onos ${host} <<-EOF |
| 284 | |
| 285 | log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler |
| 286 | log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier |
| 287 | log:set DEBUG org.onosproject.ui.impl.UiWebSocket |
| 288 | log:set DEBUG org.onosproject.ui.impl.UiTopoSession |
| 289 | log:list |
| 290 | |
| 291 | EOF |