Simon Hunt | 0ee20bf | 2017-05-10 19:59:17 -0700 | [diff] [blame] | 1 | #!/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 | |
| 9 | host=${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 | |
| 18 | onos ${host} <<-EOF |
| 19 | |
| 20 | # -- define regions |
| 21 | region-add rA "Region A" LOGICAL_GROUP 30 20 grid ${host} |
| 22 | region-add rB "Region B" LOGICAL_GROUP 30 40 grid ${host} |
| 23 | region-add rC "Region C" LOGICAL_GROUP 30 60 grid ${host} |
| 24 | |
| 25 | # -- set peer locations |
Simon Hunt | cc2d7fc | 2017-05-11 17:26:30 -0700 | [diff] [blame] | 26 | region-add-peer-loc rA rB 40 70 grid |
| 27 | region-add-peer-loc rA rC 50 70 grid |
Simon Hunt | 0ee20bf | 2017-05-10 19:59:17 -0700 | [diff] [blame] | 28 | |
Simon Hunt | cc2d7fc | 2017-05-11 17:26:30 -0700 | [diff] [blame] | 29 | region-add-peer-loc rB rA 30 10 grid |
| 30 | region-add-peer-loc rB rC 30 70 grid |
Simon Hunt | 0ee20bf | 2017-05-10 19:59:17 -0700 | [diff] [blame] | 31 | |
Simon Hunt | cc2d7fc | 2017-05-11 17:26:30 -0700 | [diff] [blame] | 32 | region-add-peer-loc rC rA 10 10 grid |
| 33 | region-add-peer-loc rC rB 20 10 grid |
Simon Hunt | 0ee20bf | 2017-05-10 19:59:17 -0700 | [diff] [blame] | 34 | |
| 35 | EOF |
| 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 | |
| 44 | onos ${host} <<-EOF |
| 45 | |
| 46 | # -- top level |
| 47 | layout-add root +plain . . 1.0 0.0 0.0 |
| 48 | |
| 49 | # -- layouts for top level regions |
| 50 | layout-add lA +plain rA root 1.0 0.0 0.0 |
| 51 | layout-add lB +plain rB root 1.0 0.0 0.0 |
| 52 | layout-add lC +plain rC root 1.0 0.0 0.0 |
| 53 | |
| 54 | # -- summary |
| 55 | layouts |
| 56 | EOF |
| 57 | |
| 58 | ###------------------------------------------------------ |
| 59 | ### Assign devices to each of their regions |
| 60 | |
| 61 | onos ${host} <<-EOF |
| 62 | |
| 63 | region-add-devices rA \ |
| 64 | of:0000000000000001 \ |
| 65 | of:0000000000000002 \ |
| 66 | |
| 67 | region-add-devices rB \ |
| 68 | of:0000000000000003 \ |
| 69 | of:0000000000000004 \ |
| 70 | |
| 71 | region-add-devices rC \ |
| 72 | of:0000000000000005 \ |
| 73 | of:0000000000000006 \ |
| 74 | |
| 75 | EOF |
| 76 | |
| 77 | ###------------------------------------------------------ |
| 78 | ### Configure devices and hosts |
| 79 | |
| 80 | onos-netcfg ${host} regionabc.json |
| 81 | |
| 82 | |