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/reactive-routing/src/main/java/org/onosproject/reactive/routing/SdnIpReactiveRouting.java b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/SdnIpReactiveRouting.java
index a05e394..96aa06e 100644
--- a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/SdnIpReactiveRouting.java
+++ b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/SdnIpReactiveRouting.java
@@ -305,16 +305,19 @@
         LocationType dstIpLocationType = getLocationType(dstIp);
         Optional<Interface> srcInterface =
                 interfaceService.getInterfacesByPort(srcConnectPoint).stream().findFirst();
+        Set<ConnectPoint> ingressPoints = config.getBgpPeerConnectPoints();
 
         switch (dstIpLocationType) {
         case INTERNET:
-            if (!srcInterface.isPresent()) {
+            if (srcInterface.isPresent() &&
+                    (!ingressPoints.contains(srcConnectPoint))) {
                 return TrafficType.HOST_TO_INTERNET;
             } else {
                 return TrafficType.INTERNET_TO_INTERNET;
             }
         case LOCAL:
-            if (!srcInterface.isPresent()) {
+            if (srcInterface.isPresent() &&
+                    (!ingressPoints.contains(srcConnectPoint))) {
                 return TrafficType.HOST_TO_HOST;
             } else {
                 // TODO Currently we only consider local public prefixes.
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