blob: 3b161177fcb892a0ac0257e7fb4640896acec166 [file] [log] [blame]
Simon Hunt0ee20bf2017-05-10 19:59:17 -07001#!/bin/bash
2#
3# A simple test topology of three regions, A, B, and C.
4#
5# Script Configuration:
6#
7# host : the controller instance against which this script is run
8
9host=${1:-127.0.0.1}
10
11
12###------------------------------------------------------
13### Start by adding the three regions A, B, and C
14
15# region-add <region-id> <region-name> <region-type> \
16# <lat/Y> <long/X> <locType> <region-master>
17
18onos ${host} <<-EOF
19
20# -- define regions
21region-add rA "Region A" LOGICAL_GROUP 30 20 grid ${host}
22region-add rB "Region B" LOGICAL_GROUP 30 40 grid ${host}
23region-add rC "Region C" LOGICAL_GROUP 30 60 grid ${host}
24
25# -- set peer locations
Simon Huntcc2d7fc2017-05-11 17:26:30 -070026region-add-peer-loc rA rB 40 70 grid
27region-add-peer-loc rA rC 50 70 grid
Simon Hunt0ee20bf2017-05-10 19:59:17 -070028
Simon Huntcc2d7fc2017-05-11 17:26:30 -070029region-add-peer-loc rB rA 30 10 grid
30region-add-peer-loc rB rC 30 70 grid
Simon Hunt0ee20bf2017-05-10 19:59:17 -070031
Simon Huntcc2d7fc2017-05-11 17:26:30 -070032region-add-peer-loc rC rA 10 10 grid
33region-add-peer-loc rC rB 20 10 grid
Simon Hunt0ee20bf2017-05-10 19:59:17 -070034
35EOF
36
37###------------------------------------------------------
38### Add layouts, associating backing regions, and optional parent
39
40# layout-add <layout-id> <bg-ref> \
41# [ <region-id> <parent-layout-id> <scale> <offset-x> <offset-y> ]
42#
43
44onos ${host} <<-EOF
45
46# -- top level
47layout-add root +plain . . 1.0 0.0 0.0
48
49# -- layouts for top level regions
50layout-add lA +plain rA root 1.0 0.0 0.0
51layout-add lB +plain rB root 1.0 0.0 0.0
52layout-add lC +plain rC root 1.0 0.0 0.0
53
54# -- summary
55layouts
56EOF
57
58###------------------------------------------------------
59### Assign devices to each of their regions
60
61onos ${host} <<-EOF
62
63region-add-devices rA \
64 of:0000000000000001 \
65 of:0000000000000002 \
66
67region-add-devices rB \
68 of:0000000000000003 \
69 of:0000000000000004 \
70
71region-add-devices rC \
72 of:0000000000000005 \
73 of:0000000000000006 \
74
75EOF
76
77###------------------------------------------------------
78### Configure devices and hosts
79
80onos-netcfg ${host} regionabc.json
81
82