Committed by
Gerrit Code Review
remove eapol rule when vlan rules are pushed.
reinstall eapol rule when vlan rule is removed. Change-Id: I6e5f502206dacd915127d38d9309e34b20f46de4
Showing
1 changed file
with
13 additions
and
8 deletions
| ... | @@ -150,7 +150,8 @@ public class Olt | ... | @@ -150,7 +150,8 @@ public class Olt |
| 150 | .flatMap(did -> deviceService.getPorts(did).stream()) | 150 | .flatMap(did -> deviceService.getPorts(did).stream()) |
| 151 | .filter(p -> !oltData.get(p.element().id()).uplink().equals(p.number())) | 151 | .filter(p -> !oltData.get(p.element().id()).uplink().equals(p.number())) |
| 152 | .filter(p -> p.isEnabled()) | 152 | .filter(p -> p.isEnabled()) |
| 153 | - .forEach(p -> processFilteringObjectives((DeviceId) p.element().id(), p, true)); | 153 | + .forEach(p -> processFilteringObjectives((DeviceId) p.element().id(), |
| 154 | + p.number(), true)); | ||
| 154 | 155 | ||
| 155 | deviceService.addListener(deviceListener); | 156 | deviceService.addListener(deviceListener); |
| 156 | 157 | ||
| ... | @@ -232,6 +233,7 @@ public class Olt | ... | @@ -232,6 +233,7 @@ public class Olt |
| 232 | deviceId, | 233 | deviceId, |
| 233 | deviceVlan, | 234 | deviceVlan, |
| 234 | subscriberVlan)); | 235 | subscriberVlan)); |
| 236 | + processFilteringObjectives(deviceId, subscriberPort, true); | ||
| 235 | } else if (downStatus != null) { | 237 | } else if (downStatus != null) { |
| 236 | log.error("Subscriber with vlan {} on device {} " + | 238 | log.error("Subscriber with vlan {} on device {} " + |
| 237 | "on port {} failed downstream uninstallation: {}", | 239 | "on port {} failed downstream uninstallation: {}", |
| ... | @@ -333,6 +335,8 @@ public class Olt | ... | @@ -333,6 +335,8 @@ public class Olt |
| 333 | deviceId, | 335 | deviceId, |
| 334 | deviceVlan, | 336 | deviceVlan, |
| 335 | subscriberVlan)); | 337 | subscriberVlan)); |
| 338 | + | ||
| 339 | + processFilteringObjectives(deviceId, subscriberPort, false); | ||
| 336 | } else if (downStatus != null) { | 340 | } else if (downStatus != null) { |
| 337 | log.error("Subscriber with vlan {} on device {} " + | 341 | log.error("Subscriber with vlan {} on device {} " + |
| 338 | "on port {} failed downstream installation: {}", | 342 | "on port {} failed downstream installation: {}", |
| ... | @@ -346,11 +350,11 @@ public class Olt | ... | @@ -346,11 +350,11 @@ public class Olt |
| 346 | 350 | ||
| 347 | } | 351 | } |
| 348 | 352 | ||
| 349 | - private void processFilteringObjectives(DeviceId devId, Port port, boolean install) { | 353 | + private void processFilteringObjectives(DeviceId devId, PortNumber port, boolean install) { |
| 350 | DefaultFilteringObjective.Builder builder = DefaultFilteringObjective.builder(); | 354 | DefaultFilteringObjective.Builder builder = DefaultFilteringObjective.builder(); |
| 351 | 355 | ||
| 352 | FilteringObjective eapol = (install ? builder.permit() : builder.deny()) | 356 | FilteringObjective eapol = (install ? builder.permit() : builder.deny()) |
| 353 | - .withKey(Criteria.matchInPort(port.number())) | 357 | + .withKey(Criteria.matchInPort(port)) |
| 354 | .addCondition(Criteria.matchEthType(EthType.EtherType.EAPOL.ethType())) | 358 | .addCondition(Criteria.matchEthType(EthType.EtherType.EAPOL.ethType())) |
| 355 | .withMeta(DefaultTrafficTreatment.builder() | 359 | .withMeta(DefaultTrafficTreatment.builder() |
| 356 | .setOutput(PortNumber.CONTROLLER).build()) | 360 | .setOutput(PortNumber.CONTROLLER).build()) |
| ... | @@ -388,7 +392,7 @@ public class Olt | ... | @@ -388,7 +392,7 @@ public class Olt |
| 388 | case PORT_ADDED: | 392 | case PORT_ADDED: |
| 389 | if (!oltData.get(devId).uplink().equals(event.port().number()) && | 393 | if (!oltData.get(devId).uplink().equals(event.port().number()) && |
| 390 | event.port().isEnabled()) { | 394 | event.port().isEnabled()) { |
| 391 | - processFilteringObjectives(devId, event.port(), true); | 395 | + processFilteringObjectives(devId, event.port().number(), true); |
| 392 | } | 396 | } |
| 393 | break; | 397 | break; |
| 394 | case PORT_REMOVED: | 398 | case PORT_REMOVED: |
| ... | @@ -398,7 +402,7 @@ public class Olt | ... | @@ -398,7 +402,7 @@ public class Olt |
| 398 | olt.vlan()); | 402 | olt.vlan()); |
| 399 | if (!oltData.get(devId).uplink().equals(event.port().number()) && | 403 | if (!oltData.get(devId).uplink().equals(event.port().number()) && |
| 400 | event.port().isEnabled()) { | 404 | event.port().isEnabled()) { |
| 401 | - processFilteringObjectives(devId, event.port(), false); | 405 | + processFilteringObjectives(devId, event.port().number(), false); |
| 402 | } | 406 | } |
| 403 | break; | 407 | break; |
| 404 | case PORT_UPDATED: | 408 | case PORT_UPDATED: |
| ... | @@ -406,9 +410,9 @@ public class Olt | ... | @@ -406,9 +410,9 @@ public class Olt |
| 406 | break; | 410 | break; |
| 407 | } | 411 | } |
| 408 | if (event.port().isEnabled()) { | 412 | if (event.port().isEnabled()) { |
| 409 | - processFilteringObjectives(devId, event.port(), true); | 413 | + processFilteringObjectives(devId, event.port().number(), true); |
| 410 | } else { | 414 | } else { |
| 411 | - processFilteringObjectives(devId, event.port(), false); | 415 | + processFilteringObjectives(devId, event.port().number(), false); |
| 412 | } | 416 | } |
| 413 | break; | 417 | break; |
| 414 | case DEVICE_ADDED: | 418 | case DEVICE_ADDED: |
| ... | @@ -471,7 +475,8 @@ public class Olt | ... | @@ -471,7 +475,8 @@ public class Olt |
| 471 | ports.stream() | 475 | ports.stream() |
| 472 | .filter(p -> !oltData.get(p.element().id()).uplink().equals(p.number())) | 476 | .filter(p -> !oltData.get(p.element().id()).uplink().equals(p.number())) |
| 473 | .filter(p -> p.isEnabled()) | 477 | .filter(p -> p.isEnabled()) |
| 474 | - .forEach(p -> processFilteringObjectives((DeviceId) p.element().id(), p, true)); | 478 | + .forEach(p -> processFilteringObjectives((DeviceId) p.element().id(), |
| 479 | + p.number(), true)); | ||
| 475 | 480 | ||
| 476 | } | 481 | } |
| 477 | 482 | ... | ... |
-
Please register or login to post a comment