Fix bug where SDN-IP installs more intents than needed
Ported from onos-1.2 branch. Change-Id: Ic085d5033105e0c688369a71de077c7541d26dbf (cherry picked from commit 1258f86b)
Showing
1 changed file
with
9 additions
and
3 deletions
... | @@ -26,6 +26,7 @@ import org.onosproject.net.flow.DefaultTrafficSelector; | ... | @@ -26,6 +26,7 @@ import org.onosproject.net.flow.DefaultTrafficSelector; |
26 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 26 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
27 | import org.onosproject.net.flow.TrafficSelector; | 27 | import org.onosproject.net.flow.TrafficSelector; |
28 | import org.onosproject.net.flow.TrafficTreatment; | 28 | import org.onosproject.net.flow.TrafficTreatment; |
29 | +import org.onosproject.net.host.InterfaceIpAddress; | ||
29 | import org.onosproject.net.intent.PointToPointIntent; | 30 | import org.onosproject.net.intent.PointToPointIntent; |
30 | import org.onosproject.routing.config.BgpPeer; | 31 | import org.onosproject.routing.config.BgpPeer; |
31 | import org.onosproject.routing.config.BgpSpeaker; | 32 | import org.onosproject.routing.config.BgpSpeaker; |
... | @@ -148,9 +149,14 @@ public class PeerConnectivityManager { | ... | @@ -148,9 +149,14 @@ public class PeerConnectivityManager { |
148 | 149 | ||
149 | IpAddress bgpdAddress = null; | 150 | IpAddress bgpdAddress = null; |
150 | for (InterfaceAddress interfaceAddress : interfaceAddresses) { | 151 | for (InterfaceAddress interfaceAddress : interfaceAddresses) { |
151 | - if (interfaceAddress.connectPoint().equals( | 152 | + if (interfaceAddress.connectPoint().equals(peerInterface.connectPoint())) { |
152 | - peerInterface.connectPoint())) { | 153 | + for (InterfaceIpAddress interfaceIpAddress : peerInterface.ipAddresses()) { |
153 | - bgpdAddress = interfaceAddress.ipAddress(); | 154 | + // Only add intents where the peer and ONOS's addresses are |
155 | + // in the same subnet | ||
156 | + if (interfaceIpAddress.subnetAddress().contains(bgpPeer.ipAddress())) { | ||
157 | + bgpdAddress = interfaceAddress.ipAddress(); | ||
158 | + } | ||
159 | + } | ||
154 | break; | 160 | break; |
155 | } | 161 | } |
156 | } | 162 | } | ... | ... |
-
Please register or login to post a comment