Pingping Lin
Committed by Ray Milkey

paths should from bgp peer connect points for Internet-to-local traffic

Change-Id: I04c7f5b8efc9279ee3e15fb27435a2201cccb5f1
...@@ -81,6 +81,14 @@ public interface RoutingConfigurationService { ...@@ -81,6 +81,14 @@ public interface RoutingConfigurationService {
81 Set<Interface> getInterfaces(); 81 Set<Interface> getInterfaces();
82 82
83 /** 83 /**
84 + * Retrieves the entire set of connect points connected to BGP peers in the
85 + * network.
86 + *
87 + * @return the set of connect points connected to BGP peers
88 + */
89 + public Set<ConnectPoint> getBgpPeerConnectPoints();
90 +
91 + /**
84 * Retrieves the interface associated with the given connect point. 92 * Retrieves the interface associated with the given connect point.
85 * 93 *
86 * @param connectPoint the connect point to retrieve interface information 94 * @param connectPoint the connect point to retrieve interface information
......
...@@ -71,6 +71,7 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService { ...@@ -71,6 +71,7 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService {
71 private Map<String, BgpSpeaker> bgpSpeakers = new ConcurrentHashMap<>(); 71 private Map<String, BgpSpeaker> bgpSpeakers = new ConcurrentHashMap<>();
72 private Map<IpAddress, BgpPeer> bgpPeers = new ConcurrentHashMap<>(); 72 private Map<IpAddress, BgpPeer> bgpPeers = new ConcurrentHashMap<>();
73 private Set<IpAddress> gatewayIpAddresses = new HashSet<>(); 73 private Set<IpAddress> gatewayIpAddresses = new HashSet<>();
74 + private Set<ConnectPoint> bgpPeerConnectPoints = new HashSet<>();
74 75
75 private InvertedRadixTree<LocalIpPrefixEntry> 76 private InvertedRadixTree<LocalIpPrefixEntry>
76 localPrefixTable4 = new ConcurrentInvertedRadixTree<>( 77 localPrefixTable4 = new ConcurrentInvertedRadixTree<>(
...@@ -108,6 +109,7 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService { ...@@ -108,6 +109,7 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService {
108 } 109 }
109 for (BgpPeer peer : config.getPeers()) { 110 for (BgpPeer peer : config.getPeers()) {
110 bgpPeers.put(peer.ipAddress(), peer); 111 bgpPeers.put(peer.ipAddress(), peer);
112 + bgpPeerConnectPoints.add(peer.connectPoint());
111 } 113 }
112 114
113 for (LocalIpPrefixEntry entry : config.getLocalIp4PrefixEntries()) { 115 for (LocalIpPrefixEntry entry : config.getLocalIp4PrefixEntries()) {
...@@ -154,6 +156,11 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService { ...@@ -154,6 +156,11 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService {
154 } 156 }
155 157
156 @Override 158 @Override
159 + public Set<ConnectPoint> getBgpPeerConnectPoints() {
160 + return Collections.unmodifiableSet(bgpPeerConnectPoints);
161 + }
162 +
163 + @Override
157 public Interface getInterface(ConnectPoint connectPoint) { 164 public Interface getInterface(ConnectPoint connectPoint) {
158 return hostAdaptor.getInterface(connectPoint); 165 return hostAdaptor.getInterface(connectPoint);
159 } 166 }
......
...@@ -381,11 +381,9 @@ public class IntentSynchronizer implements FibListener, IntentRequestListener { ...@@ -381,11 +381,9 @@ public class IntentSynchronizer implements FibListener, IntentRequestListener {
381 @Override 381 @Override
382 public void setUpConnectivityInternetToHost(IpAddress hostIpAddress) { 382 public void setUpConnectivityInternetToHost(IpAddress hostIpAddress) {
383 checkNotNull(hostIpAddress); 383 checkNotNull(hostIpAddress);
384 - Set<ConnectPoint> ingressPoints = new HashSet<ConnectPoint>(); 384 + Set<ConnectPoint> ingressPoints =
385 - for (Interface intf : configService.getInterfaces()) { 385 + configService.getBgpPeerConnectPoints();
386 - ConnectPoint srcPoint = intf.connectPoint(); 386 +
387 - ingressPoints.add(srcPoint);
388 - }
389 TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); 387 TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
390 388
391 if (hostIpAddress.isIp4()) { 389 if (hostIpAddress.isIp4()) {
......