minor fix for olt
Change-Id: Ic0511b9cd669ea554e2d6ccead19da91a49ecfe3
diff --git a/src/main/java/org/onosproject/olt/OLT.java b/src/main/java/org/onosproject/olt/OLT.java
index 8fbdc9a..7d9780e 100644
--- a/src/main/java/org/onosproject/olt/OLT.java
+++ b/src/main/java/org/onosproject/olt/OLT.java
@@ -95,10 +95,12 @@
deviceService.getPorts(DeviceId.deviceId(oltDevice)).stream().forEach(
port -> {
- if (port.isEnabled()) {
+ if (!port.number().isLogical() && port.isEnabled()) {
short vlanId = fetchVlanId(port.number());
- provisionVlanOnPort(port.number(), (short) 7);
- provisionVlanOnPort(port.number(), vlanId);
+ if (vlanId > 0) {
+ provisionVlanOnPort(oltDevice, port.number(), (short) 7);
+ provisionVlanOnPort(oltDevice, port.number(), vlanId);
+ }
}
}
);
@@ -106,9 +108,11 @@
deviceService.getPorts(DeviceId.deviceId(gfastDevice)).stream().forEach(
port -> {
- if (port.isEnabled()) {
+ if (!port.number().isLogical() && port.isEnabled()) {
short vlanId = (short) (fetchVlanId(port.number()) + OFFSET);
- provisionVlanOnPort(port.number(), vlanId);
+ if (vlanId > 0) {
+ provisionVlanOnPort(gfastDevice, port.number(), vlanId);
+ }
}
}
);
@@ -144,8 +148,8 @@
}
- private void provisionVlanOnPort(PortNumber p, short vlanId) {
-
+ private void provisionVlanOnPort(String deviceId, PortNumber p, short vlanId) {
+ DeviceId did = DeviceId.deviceId(deviceId);
TrafficSelector upstream = DefaultTrafficSelector.builder()
.matchVlanId(VlanId.vlanId(vlanId))
@@ -184,8 +188,8 @@
.withTreatment(downStreamTreatment)
.add();
- flowObjectiveService.forward(DeviceId.deviceId(oltDevice), upFwd);
- flowObjectiveService.forward(DeviceId.deviceId(oltDevice), downFwd);
+ flowObjectiveService.forward(did, upFwd);
+ flowObjectiveService.forward(did, downFwd);
}
@@ -198,7 +202,7 @@
case PORT_UPDATED:
if (devId.equals(event.subject().id()) && event.port().isEnabled()) {
short vlanId = fetchVlanId(event.port().number());
- provisionVlanOnPort(event.port().number(), vlanId);
+ provisionVlanOnPort(gfastDevice, event.port().number(), vlanId);
}
break;
case DEVICE_ADDED: