Thomas Vachuska
Committed by Simon Hunt

Fixing regions command to list devices that are currently in the region.

Change-Id: I52098fb613844b786827f7bc97e7ecec581397ba
...@@ -42,10 +42,11 @@ public class RegionListCommand extends AbstractShellCommand { ...@@ -42,10 +42,11 @@ public class RegionListCommand extends AbstractShellCommand {
42 required = false, multiValued = false) 42 required = false, multiValued = false)
43 String id = null; 43 String id = null;
44 44
45 + private RegionService regionService;
46 +
45 @Override 47 @Override
46 protected void execute() { 48 protected void execute() {
47 - RegionService regionService = get(RegionService.class); 49 + regionService = get(RegionService.class);
48 -
49 if (id == null) { 50 if (id == null) {
50 for (Region region : getSortedRegions(regionService)) { 51 for (Region region : getSortedRegions(regionService)) {
51 printRegion(region); 52 printRegion(region);
...@@ -76,5 +77,6 @@ public class RegionListCommand extends AbstractShellCommand { ...@@ -76,5 +77,6 @@ public class RegionListCommand extends AbstractShellCommand {
76 private void printRegion(Region region) { 77 private void printRegion(Region region) {
77 print(FMT, region.id(), region.name(), region.type()); 78 print(FMT, region.id(), region.name(), region.type());
78 region.masters().forEach(m -> print(FMT_MASTER, m)); 79 region.masters().forEach(m -> print(FMT_MASTER, m));
80 + regionService.getRegionDevices(region.id()).forEach(id -> print(" %s", id));
79 } 81 }
80 } 82 }
......
1 +#!/bin/bash
2 +
3 +host=${1:-127.0.0.1}
4 +
5 +onos ${host} null-simulation stop custom
6 +onos ${host} wipe-out please
7 +onos ${host} null-simulation start custom
8 +
9 +sleep 1
10 +
11 +onos ${host} <<-EOF
12 +
13 +null-create-device switch s1 10 0 0
14 +null-create-device switch s2 10 0 0
15 +null-create-device switch s3 10 0 0
16 +null-create-device switch s4 10 0 0
17 +null-create-device switch s5 10 0 0
18 +null-create-device switch s6 10 0 0
19 +null-create-device switch s7 10 0 0
20 +null-create-device switch s8 10 0 0
21 +null-create-device switch s9 10 0 0
22 +# null-create-device switch s10 10 0 0
23 +
24 +null-create-link direct s1 s2
25 +null-create-link direct s2 s3
26 +null-create-link direct s2 s4
27 +null-create-link direct s3 s4
28 +null-create-link direct s3 s5
29 +null-create-link direct s6 s5
30 +null-create-link direct s6 s8
31 +null-create-link direct s7 s9
32 +null-create-link direct s8 s9
33 +null-create-link direct s5 s7
34 +null-create-link direct s8 s7
35 +
36 +EOF
37 +
38 +
39 +
40 +onos ${host} <<-EOF
41 +
42 +region-add r1 Region1 METRO ${host}
43 +region-add r2 Region2 METRO ${host}
44 +region-add r3 Region3 CAMPUS ${host}
45 +
46 +region-add-devices r1 \
47 + of:0000000000000002 \
48 + of:0000000000000003 \
49 + of:0000000000000004
50 +
51 +region-add-devices r2 \
52 + of:0000000000000005 \
53 + of:0000000000000006
54 +
55 +region-add-devices r3 \
56 + of:0000000000000007 \
57 + of:0000000000000008 \
58 + of:0000000000000009
59 +
60 +regions
61 +EOF
...\ No newline at end of file ...\ No newline at end of file