blob: d0f6d042bd48a2875adf96f75c648ce0f4ce4b54 [file] [log] [blame]
Simon Huntb3656d42017-04-07 18:15:35 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
Simon Huntb3567282017-04-07 22:59:28 -07003# Creates a Europe-based topology (with regions) using ONOS null provider
Simon Huntb3656d42017-04-07 18:15:35 -07004# -----------------------------------------------------------------------------
5
6# config
7host=${1:-localhost}
8nports=24
9sleepfor=5
10
11
12### start up null provider
13onos ${host} null-simulation stop custom
14onos ${host} wipe-out please
15onos ${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
21echo
22echo "Sleeping while sim starts up... (${sleepfor} seconds)..."
23echo
24sleep ${sleepfor}
25
26
Simon Huntb3567282017-04-07 22:59:28 -070027###------------------------------------------------------
Simon Huntb3656d42017-04-07 18:15:35 -070028### Start by adding Country regions
29# Note that Long/Lat places region icon nicely in the country center
30
Simon Huntb3567282017-04-07 22:59:28 -070031# region-add <region-id> <region-name> <region-type> <lat/Y> <long/X> <region-master>
Simon Huntb3656d42017-04-07 18:15:35 -070032
33onos ${host} <<-EOF
34
35region-add rUK "United Kingdom" COUNTRY 52.206035 -1.310384 ${host}
36region-add rIT "Italy" COUNTRY 44.447951 11.093161 ${host}
37region-add rFR "France" COUNTRY 47.066264 2.711458 ${host}
38region-add rDE "Germany" COUNTRY 50.863152 9.761971 ${host}
39region-add rES "Spain" COUNTRY 40.416704 -3.7035824 ${host}
40
41EOF
42
43
44###------------------------------------------------------
Simon Huntb3656d42017-04-07 18:15:35 -070045### 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
50onos ${host} <<-EOF
51
52# -- root layout
53layout-add root @europe . . 6.664 -2992.552 -2473.084
54
55# -- layouts for top level regions
Simon Huntb3567282017-04-07 22:59:28 -070056layout-add lUK @europe rUK root 31.43 -14979.6 -12644.8
57layout-add lIT @europe rIT root 14.72 -7793.2 -6623.8
58layout-add lFR @europe rFR root 16.91 -8225.7 -7198.1
59layout-add lDE @europe rDE root 17.63 -9119.6 -7044.9
60layout-add lES @europe rES root 21.41 -9994.5 -10135.6
Simon Huntb3656d42017-04-07 18:15:35 -070061
62# -- layouts for country sub-regions
63# TODO
64
65# -- summary of installed layouts
66layouts
Simon Huntb3656d42017-04-07 18:15:35 -070067EOF
68
Simon Huntb3567282017-04-07 22:59:28 -070069###------------------------------------------------------
70### Add devices, hosts and links for each of the regions
71
72onos ${host} <<-EOF
73
74# -- UK devices
75
76null-create-device switch London ${nports} 51.5073 -0.1276
77null-create-device switch Reading ${nports} 51.4543 -0.9781
78null-create-device switch Portsmouth ${nports} 50.8198 -1.0880
79null-create-device switch Bristol ${nports} 51.4545 -2.5879
80null-create-device switch Warrington ${nports} 53.3900 -2.5970
81null-create-device switch Leeds ${nports} 53.8008 -1.5491
82
83# -- Assign UK devices to UK region
84
85region-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
95null-create-host London 192.168.1.1 51.8697 -0.0287
96null-create-host London 192.168.1.2 51.7225 0.7624
97null-create-host London 192.168.1.3 51.1437 0.4694
98
99null-create-host Bristol 192.168.1.4 51.7500 -2.6000
100
101# -- UK connectivity
102
103null-create-link direct London Reading
104null-create-link direct London Portsmouth
105null-create-link direct Reading Bristol
106null-create-link direct Portsmouth Bristol
107null-create-link direct Reading Warrington
108null-create-link direct London Leeds
109null-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
121null-create-device switch Paris ${nports} 48.8566 2.3522
122null-create-device switch Lyon ${nports} 45.7640 4.8357
123null-create-device switch Bordeaux ${nports} 44.8378 -0.5792
124null-create-device switch Marseille ${nports} 43.2965 5.3698
125null-create-device switch Nice ${nports} 43.7102 7.2620
126
127# -- Assign France devices to France region
128
129region-add-devices rFR \
130 null:0000000000000007 \
131 null:0000000000000008 \
132 null:0000000000000009 \
133 null:000000000000000a \
134 null:000000000000000b \
135
136
137# -- France hosts
138
139null-create-host Paris 192.168.2.1 49.5134 2.8882
140null-create-host Lyon 192.168.2.2 46.4590 5.2380
141
142# -- France connectivity
143
144null-create-link direct Paris Lyon
145null-create-link direct Paris Bordeaux
146null-create-link direct Lyon Bordeaux
147null-create-link direct Marseille Bordeaux
148null-create-link direct Marseille Lyon
149null-create-link direct Marseille Nice
150null-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
159EOF
Simon Huntb3656d42017-04-07 18:15:35 -0700160
161### Set up debug log messages for classes we care about
162onos ${host} <<-EOF
163log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
164log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier
165log:set DEBUG org.onosproject.ui.impl.UiWebSocket
166log:set DEBUG org.onosproject.ui.impl.UiTopoSession
167log:list
168EOF