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
diff --git a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
index 0e0207e..9a6680e 100644
--- a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
+++ b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
@@ -160,6 +160,15 @@
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 @@
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()))