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 | |
| 41 | EOF |
| 42 | |
| 43 | |
| 44 | ###------------------------------------------------------ |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 45 | ### Add layouts, associating backing regions, and optional parent. |
| 46 | # layout-add <layout-id> <bg-ref> \ |
| 47 | # [ <region-id> <parent-layout-id> <scale> <offset-x> <offset-y> ] |
| 48 | # |
| 49 | |
| 50 | onos ${host} <<-EOF |
| 51 | |
| 52 | # -- root layout |
| 53 | layout-add root @europe . . 6.664 -2992.552 -2473.084 |
| 54 | |
| 55 | # -- layouts for top level regions |
Simon Hunt | b356728 | 2017-04-07 22:59:28 -0700 | [diff] [blame^] | 56 | layout-add lUK @europe rUK root 31.43 -14979.6 -12644.8 |
| 57 | layout-add lIT @europe rIT root 14.72 -7793.2 -6623.8 |
| 58 | layout-add lFR @europe rFR root 16.91 -8225.7 -7198.1 |
| 59 | layout-add lDE @europe rDE root 17.63 -9119.6 -7044.9 |
| 60 | layout-add lES @europe rES root 21.41 -9994.5 -10135.6 |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 61 | |
| 62 | # -- layouts for country sub-regions |
| 63 | # TODO |
| 64 | |
| 65 | # -- summary of installed layouts |
| 66 | layouts |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 67 | EOF |
| 68 | |
Simon Hunt | b356728 | 2017-04-07 22:59:28 -0700 | [diff] [blame^] | 69 | ###------------------------------------------------------ |
| 70 | ### Add devices, hosts and links for each of the regions |
| 71 | |
| 72 | onos ${host} <<-EOF |
| 73 | |
| 74 | # -- UK devices |
| 75 | |
| 76 | null-create-device switch London ${nports} 51.5073 -0.1276 |
| 77 | null-create-device switch Reading ${nports} 51.4543 -0.9781 |
| 78 | null-create-device switch Portsmouth ${nports} 50.8198 -1.0880 |
| 79 | null-create-device switch Bristol ${nports} 51.4545 -2.5879 |
| 80 | null-create-device switch Warrington ${nports} 53.3900 -2.5970 |
| 81 | null-create-device switch Leeds ${nports} 53.8008 -1.5491 |
| 82 | |
| 83 | # -- Assign UK devices to UK region |
| 84 | |
| 85 | region-add-devices rUK \ |
| 86 | null:0000000000000001 \ |
| 87 | null:0000000000000002 \ |
| 88 | null:0000000000000003 \ |
| 89 | null:0000000000000004 \ |
| 90 | null:0000000000000005 \ |
| 91 | null:0000000000000006 \ |
| 92 | |
| 93 | # -- UK hosts |
| 94 | |
| 95 | null-create-host London 192.168.1.1 51.8697 -0.0287 |
| 96 | null-create-host London 192.168.1.2 51.7225 0.7624 |
| 97 | null-create-host London 192.168.1.3 51.1437 0.4694 |
| 98 | |
| 99 | null-create-host Bristol 192.168.1.4 51.7500 -2.6000 |
| 100 | |
| 101 | # -- UK connectivity |
| 102 | |
| 103 | null-create-link direct London Reading |
| 104 | null-create-link direct London Portsmouth |
| 105 | null-create-link direct Reading Bristol |
| 106 | null-create-link direct Portsmouth Bristol |
| 107 | null-create-link direct Reading Warrington |
| 108 | null-create-link direct London Leeds |
| 109 | null-create-link direct Leeds Warrington |
| 110 | |
| 111 | # -- UK Peers |
| 112 | |
| 113 | # rUK_rES 50.4060 -3.3860 |
| 114 | # rUK_rFR 50.4060 -1.8482 |
| 115 | # rUK_rIT 50.4060 -0.1361 |
| 116 | # rUK_rDE 50.4060 1.2491 |
| 117 | |
| 118 | |
| 119 | # -- France Devices |
| 120 | |
| 121 | null-create-device switch Paris ${nports} 48.8566 2.3522 |
| 122 | null-create-device switch Lyon ${nports} 45.7640 4.8357 |
| 123 | null-create-device switch Bordeaux ${nports} 44.8378 -0.5792 |
| 124 | null-create-device switch Marseille ${nports} 43.2965 5.3698 |
| 125 | null-create-device switch Nice ${nports} 43.7102 7.2620 |
| 126 | |
| 127 | # -- Assign France devices to France region |
| 128 | |
| 129 | region-add-devices rFR \ |
| 130 | null:0000000000000007 \ |
| 131 | null:0000000000000008 \ |
| 132 | null:0000000000000009 \ |
| 133 | null:000000000000000a \ |
| 134 | null:000000000000000b \ |
| 135 | |
| 136 | |
| 137 | # -- France hosts |
| 138 | |
| 139 | null-create-host Paris 192.168.2.1 49.5134 2.8882 |
| 140 | null-create-host Lyon 192.168.2.2 46.4590 5.2380 |
| 141 | |
| 142 | # -- France connectivity |
| 143 | |
| 144 | null-create-link direct Paris Lyon |
| 145 | null-create-link direct Paris Bordeaux |
| 146 | null-create-link direct Lyon Bordeaux |
| 147 | null-create-link direct Marseille Bordeaux |
| 148 | null-create-link direct Marseille Lyon |
| 149 | null-create-link direct Marseille Nice |
| 150 | null-create-link direct Lyon Nice |
| 151 | |
| 152 | # -- France Peers |
| 153 | |
| 154 | # rFR_rES 42.6806 -2.1273 |
| 155 | # rFR_rUK 50.6164 -2.1013 |
| 156 | # rFR_rIT 45.1105 9.7450 |
| 157 | # rFR_rDE 49.6307 7.9326 |
| 158 | |
| 159 | EOF |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 160 | |
| 161 | ### Set up debug log messages for classes we care about |
| 162 | onos ${host} <<-EOF |
| 163 | log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler |
| 164 | log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier |
| 165 | log:set DEBUG org.onosproject.ui.impl.UiWebSocket |
| 166 | log:set DEBUG org.onosproject.ui.impl.UiTopoSession |
| 167 | log:list |
| 168 | EOF |