Committed by
Gerrit Code Review
enable run reactive routing without BGP
Another improment is: if we config interfaces for local subnet in network-cfg.json, sdn-ip will classify the traffic correctly Change-Id: I94d80bc5a7c29b70e6c8546d99b71850cfb3f14d
Showing
3 changed files
with
17 additions
and
11 deletions
| ... | @@ -305,16 +305,19 @@ public class SdnIpReactiveRouting { | ... | @@ -305,16 +305,19 @@ public class SdnIpReactiveRouting { |
| 305 | LocationType dstIpLocationType = getLocationType(dstIp); | 305 | LocationType dstIpLocationType = getLocationType(dstIp); |
| 306 | Optional<Interface> srcInterface = | 306 | Optional<Interface> srcInterface = |
| 307 | interfaceService.getInterfacesByPort(srcConnectPoint).stream().findFirst(); | 307 | interfaceService.getInterfacesByPort(srcConnectPoint).stream().findFirst(); |
| 308 | + Set<ConnectPoint> ingressPoints = config.getBgpPeerConnectPoints(); | ||
| 308 | 309 | ||
| 309 | switch (dstIpLocationType) { | 310 | switch (dstIpLocationType) { |
| 310 | case INTERNET: | 311 | case INTERNET: |
| 311 | - if (!srcInterface.isPresent()) { | 312 | + if (srcInterface.isPresent() && |
| 313 | + (!ingressPoints.contains(srcConnectPoint))) { | ||
| 312 | return TrafficType.HOST_TO_INTERNET; | 314 | return TrafficType.HOST_TO_INTERNET; |
| 313 | } else { | 315 | } else { |
| 314 | return TrafficType.INTERNET_TO_INTERNET; | 316 | return TrafficType.INTERNET_TO_INTERNET; |
| 315 | } | 317 | } |
| 316 | case LOCAL: | 318 | case LOCAL: |
| 317 | - if (!srcInterface.isPresent()) { | 319 | + if (srcInterface.isPresent() && |
| 320 | + (!ingressPoints.contains(srcConnectPoint))) { | ||
| 318 | return TrafficType.HOST_TO_HOST; | 321 | return TrafficType.HOST_TO_HOST; |
| 319 | } else { | 322 | } else { |
| 320 | // TODO Currently we only consider local public prefixes. | 323 | // TODO Currently we only consider local public prefixes. | ... | ... |
| ... | @@ -32,8 +32,8 @@ import java.util.List; | ... | @@ -32,8 +32,8 @@ import java.util.List; |
| 32 | public class Configuration { | 32 | public class Configuration { |
| 33 | // We call the BGP routers in our SDN network the BGP speakers, and call | 33 | // We call the BGP routers in our SDN network the BGP speakers, and call |
| 34 | // the BGP routers outside our SDN network the BGP peers. | 34 | // the BGP routers outside our SDN network the BGP peers. |
| 35 | - private List<BgpSpeaker> bgpSpeakers; | 35 | + private List<BgpSpeaker> bgpSpeakers = Collections.emptyList(); |
| 36 | - private List<BgpPeer> peers; | 36 | + private List<BgpPeer> peers = Collections.emptyList(); |
| 37 | private MacAddress virtualGatewayMacAddress; | 37 | private MacAddress virtualGatewayMacAddress; |
| 38 | 38 | ||
| 39 | // All IP prefixes from the configuration are local | 39 | // All IP prefixes from the configuration are local | ... | ... |
| ... | @@ -195,13 +195,16 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService { | ... | @@ -195,13 +195,16 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService { |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | BgpConfig bgpConfig = configService.getConfig(routerAppId, BgpConfig.class); | 197 | BgpConfig bgpConfig = configService.getConfig(routerAppId, BgpConfig.class); |
| 198 | - | 198 | + if (bgpConfig == null) { |
| 199 | - return bgpConfig.bgpSpeakers().stream() | 199 | + return Collections.emptySet(); |
| 200 | - .flatMap(speaker -> speaker.peers().stream()) | 200 | + } else { |
| 201 | - .map(peer -> interfaceService.getMatchingInterface(peer)) | 201 | + return bgpConfig.bgpSpeakers().stream() |
| 202 | - .filter(intf -> intf != null) | 202 | + .flatMap(speaker -> speaker.peers().stream()) |
| 203 | - .map(intf -> intf.connectPoint()) | 203 | + .map(peer -> interfaceService.getMatchingInterface(peer)) |
| 204 | - .collect(Collectors.toSet()); | 204 | + .filter(intf -> intf != null) |
| 205 | + .map(intf -> intf.connectPoint()) | ||
| 206 | + .collect(Collectors.toSet()); | ||
| 207 | + } | ||
| 205 | } | 208 | } |
| 206 | 209 | ||
| 207 | @Override | 210 | @Override | ... | ... |
-
Please register or login to post a comment