[ONOS-3410] Let sdn-ip support default route

Default route is an important and frequntly used feature in BGP.
For example, network operators want to reduce the size of the route table.

The current sdn-ip does not support this feature. So this patch is to
let sdn-ip support this feature.

Change-Id: Ibb5afe3711522468e4902da2e090370db71b29da
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java
index c0001bd..9113e01 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java
@@ -83,7 +83,8 @@
 
 
     @Override
-    public void update(Collection<FibUpdate> updates, Collection<FibUpdate> withdraws) {
+    public void update(Collection<FibUpdate> updates,
+                       Collection<FibUpdate> withdraws) {
         int submitCount = 0, withdrawCount = 0;
         //
         // NOTE: Semantically, we MUST withdraw existing intents before
@@ -157,7 +158,8 @@
             MacAddress nextHopMacAddress) {
 
         // Find the attachment point (egress interface) of the next hop
-        Interface egressInterface = interfaceService.getMatchingInterface(nextHopIpAddress);
+        Interface egressInterface =
+                interfaceService.getMatchingInterface(nextHopIpAddress);
         if (egressInterface == null) {
             log.warn("No outgoing interface found for {}",
                     nextHopIpAddress);
@@ -182,10 +184,19 @@
         TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
         if (prefix.isIp4()) {
             selector.matchEthType(Ethernet.TYPE_IPV4);
-            selector.matchIPDst(prefix);
+            // if it is default route, then we do not need match destination
+            // IP address
+            if (prefix.prefixLength() != 0) {
+                selector.matchIPDst(prefix);
+            }
         } else {
             selector.matchEthType(Ethernet.TYPE_IPV6);
-            selector.matchIPv6Dst(prefix);
+            // if it is default route, then we do not need match destination
+            // IP address
+            if (prefix.prefixLength() != 0) {
+                selector.matchIPv6Dst(prefix);
+            }
+
         }
 
         // Rewrite the destination MAC address