aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config')
-rw-r--r--framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java4
-rw-r--r--framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java17
2 files changed, 12 insertions, 9 deletions
diff --git a/framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java b/framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java
index 45206903..c58bc1b9 100644
--- a/framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java
+++ b/framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java
@@ -32,8 +32,8 @@ import java.util.List;
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/framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java b/framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
index 0a6f9d4c..19c3f70b 100644
--- a/framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
+++ b/framework/src/onos/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
@@ -195,13 +195,16 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService {
}
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