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 {
Set<Interface> getInterfaces();
/**
* Retrieves the entire set of connect points connected to BGP peers in the
* network.
*
* @return the set of connect points connected to BGP peers
*/
public Set<ConnectPoint> getBgpPeerConnectPoints();
/**
* Retrieves the interface associated with the given connect point.
*
* @param connectPoint the connect point to retrieve interface information
......
......@@ -71,6 +71,7 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService {
private Map<String, BgpSpeaker> bgpSpeakers = new ConcurrentHashMap<>();
private Map<IpAddress, BgpPeer> bgpPeers = new ConcurrentHashMap<>();
private Set<IpAddress> gatewayIpAddresses = new HashSet<>();
private Set<ConnectPoint> bgpPeerConnectPoints = new HashSet<>();
private InvertedRadixTree<LocalIpPrefixEntry>
localPrefixTable4 = new ConcurrentInvertedRadixTree<>(
......@@ -108,6 +109,7 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService {
}
for (BgpPeer peer : config.getPeers()) {
bgpPeers.put(peer.ipAddress(), peer);
bgpPeerConnectPoints.add(peer.connectPoint());
}
for (LocalIpPrefixEntry entry : config.getLocalIp4PrefixEntries()) {
......@@ -154,6 +156,11 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService {
}
@Override
public Set<ConnectPoint> getBgpPeerConnectPoints() {
return Collections.unmodifiableSet(bgpPeerConnectPoints);
}
@Override
public Interface getInterface(ConnectPoint connectPoint) {
return hostAdaptor.getInterface(connectPoint);
}
......
......@@ -381,11 +381,9 @@ public class IntentSynchronizer implements FibListener, IntentRequestListener {
@Override
public void setUpConnectivityInternetToHost(IpAddress hostIpAddress) {
checkNotNull(hostIpAddress);
Set<ConnectPoint> ingressPoints = new HashSet<ConnectPoint>();
for (Interface intf : configService.getInterfaces()) {
ConnectPoint srcPoint = intf.connectPoint();
ingressPoints.add(srcPoint);
}
Set<ConnectPoint> ingressPoints =
configService.getBgpPeerConnectPoints();
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
if (hostIpAddress.isIp4()) {
......