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 {
required = false, multiValued = false)
String id = null;
private RegionService regionService;
@Override
protected void execute() {
RegionService regionService = get(RegionService.class);
regionService = get(RegionService.class);
if (id == null) {
for (Region region : getSortedRegions(regionService)) {
printRegion(region);
......@@ -76,5 +77,6 @@ public class RegionListCommand extends AbstractShellCommand {
private void printRegion(Region region) {
print(FMT, region.id(), region.name(), region.type());
region.masters().forEach(m -> print(FMT_MASTER, m));
regionService.getRegionDevices(region.id()).forEach(id -> print(" %s", id));
}
}
......
#!/bin/bash
host=${1:-127.0.0.1}
onos ${host} null-simulation stop custom
onos ${host} wipe-out please
onos ${host} null-simulation start custom
sleep 1
onos ${host} <<-EOF
null-create-device switch s1 10 0 0
null-create-device switch s2 10 0 0
null-create-device switch s3 10 0 0
null-create-device switch s4 10 0 0
null-create-device switch s5 10 0 0
null-create-device switch s6 10 0 0
null-create-device switch s7 10 0 0
null-create-device switch s8 10 0 0
null-create-device switch s9 10 0 0
# null-create-device switch s10 10 0 0
null-create-link direct s1 s2
null-create-link direct s2 s3
null-create-link direct s2 s4
null-create-link direct s3 s4
null-create-link direct s3 s5
null-create-link direct s6 s5
null-create-link direct s6 s8
null-create-link direct s7 s9
null-create-link direct s8 s9
null-create-link direct s5 s7
null-create-link direct s8 s7
EOF
onos ${host} <<-EOF
region-add r1 Region1 METRO ${host}
region-add r2 Region2 METRO ${host}
region-add r3 Region3 CAMPUS ${host}
region-add-devices r1 \
of:0000000000000002 \
of:0000000000000003 \
of:0000000000000004
region-add-devices r2 \
of:0000000000000005 \
of:0000000000000006
region-add-devices r3 \
of:0000000000000007 \
of:0000000000000008 \
of:0000000000000009
regions
EOF
\ No newline at end of file