Changed to one flow mod per switch for prefix flows to prevent duplicate flow mods
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
index 248457a..37666b2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -482,13 +482,23 @@
private void addPrefixFlows(Prefix prefix, Interface egressInterface, byte[] nextHopMacAddress) {
log.debug("Adding flows for prefix {} added, next hop mac {}",
prefix, HexString.toHexString(nextHopMacAddress));
-
- //Add a flow to rewrite mac for this prefix to all other border switches
- for (Interface srcInterface : interfaces.values()) {
- if (srcInterface == egressInterface) {
- //Don't push a flow for the switch where this peer is attached
- continue;
+
+ //We only need one flow mod per switch, so pick one interface on each switch
+ Map<Long, Interface> srcInterfaces = new HashMap<Long, Interface>();
+ for (Interface intf : interfaces.values()) {
+ if (!srcInterfaces.containsKey(intf.getDpid())
+ && intf != egressInterface) {
+ srcInterfaces.put(intf.getDpid(), intf);
}
+ }
+
+ //Add a flow to rewrite mac for this prefix to all other border switches
+ //for (Interface srcInterface : interfaces.values()) {
+ for (Interface srcInterface : srcInterfaces.values()) {
+ //if (srcInterface == egressInterface) {
+ //Don't push a flow for the switch where this peer is attached
+ //continue;
+ //}
DataPath shortestPath;