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
diff --git a/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java b/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java
index 4520690..c58bc1b 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java
@@ -32,8 +32,8 @@
public class Configuration {
// We call the BGP routers in our SDN network the BGP speakers, and call
// the BGP routers outside our SDN network the BGP peers.
- private List<BgpSpeaker> bgpSpeakers;
- private List<BgpPeer> peers;
+ private List<BgpSpeaker> bgpSpeakers = Collections.emptyList();
+ private List<BgpPeer> peers = Collections.emptyList();
private MacAddress virtualGatewayMacAddress;
// All IP prefixes from the configuration are local
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 0a6f9d4..19c3f70 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
@@ -195,13 +195,16 @@
}
BgpConfig bgpConfig = configService.getConfig(routerAppId, BgpConfig.class);
-
- return bgpConfig.bgpSpeakers().stream()
- .flatMap(speaker -> speaker.peers().stream())
- .map(peer -> interfaceService.getMatchingInterface(peer))
- .filter(intf -> intf != null)
- .map(intf -> intf.connectPoint())
- .collect(Collectors.toSet());
+ if (bgpConfig == null) {
+ return Collections.emptySet();
+ } else {
+ return bgpConfig.bgpSpeakers().stream()
+ .flatMap(speaker -> speaker.peers().stream())
+ .map(peer -> interfaceService.getMatchingInterface(peer))
+ .filter(intf -> intf != null)
+ .map(intf -> intf.connectPoint())
+ .collect(Collectors.toSet());
+ }
}
@Override