Jonathan Hart
Committed by Gerrit Code Review

Minor BgpRouter tweaks to make deactivating and reactivating easier:

  * Push filters and default flows on activate if switch is already connected
  * Don't try and push filters for interfaces on other switches

Change-Id: Idf1582c168439aa06d8efa0ab4b7352e96ef3712
......@@ -160,6 +160,15 @@ public class BgpRouter {
connectivityManager.start();
icmpHandler.start();
// Initialize devices now if they are already connected
if (deviceService.isAvailable(deviceId)) {
processIntfFilters(true, configService.getInterfaces());
}
if (deviceService.isAvailable(ctrlDeviceId)) {
connectivityManager.notifySwitchAvailable();
}
log.info("BgpRouter started");
}
......@@ -352,6 +361,11 @@ public class BgpRouter {
private void processIntfFilters(boolean install, Set<Interface> intfs) {
log.info("Processing {} router interfaces", intfs.size());
for (Interface intf : intfs) {
if (!intf.connectPoint().deviceId().equals(deviceId)) {
// Ignore interfaces if they are not on the router switch
continue;
}
FilteringObjective.Builder fob = DefaultFilteringObjective.builder();
fob.withKey(Criteria.matchInPort(intf.connectPoint().port()))
.addCondition(Criteria.matchEthDst(intf.mac()))
......