paths should from bgp peer connect points for Internet-to-local traffic
Change-Id: I04c7f5b8efc9279ee3e15fb27435a2201cccb5f1
diff --git a/apps/routing-api/src/main/java/org/onosproject/routing/config/RoutingConfigurationService.java b/apps/routing-api/src/main/java/org/onosproject/routing/config/RoutingConfigurationService.java
index 0afc94b..056a195 100644
--- a/apps/routing-api/src/main/java/org/onosproject/routing/config/RoutingConfigurationService.java
+++ b/apps/routing-api/src/main/java/org/onosproject/routing/config/RoutingConfigurationService.java
@@ -81,6 +81,14 @@
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
diff --git a/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java b/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
index feffe48..60e53a1 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
@@ -71,6 +71,7 @@
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 @@
}
for (BgpPeer peer : config.getPeers()) {
bgpPeers.put(peer.ipAddress(), peer);
+ bgpPeerConnectPoints.add(peer.connectPoint());
}
for (LocalIpPrefixEntry entry : config.getLocalIp4PrefixEntries()) {
@@ -154,6 +156,11 @@
}
@Override
+ public Set<ConnectPoint> getBgpPeerConnectPoints() {
+ return Collections.unmodifiableSet(bgpPeerConnectPoints);
+ }
+
+ @Override
public Interface getInterface(ConnectPoint connectPoint) {
return hostAdaptor.getInterface(connectPoint);
}
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
index e7e6a86..0e1e34f 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
@@ -381,11 +381,9 @@
@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()) {