Added interfaces configuration to allow vRouter to be selective about what
interfaces to use.

Change-Id: I4eb069760df0995d9e831e024ddbc0493bccce0b
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java b/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java
index ee9958c..99ecaf3 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java
@@ -67,8 +67,10 @@
 
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * Programs routes to a single OpenFlow switch.
@@ -108,6 +110,8 @@
 
     private ConnectPoint controlPlaneConnectPoint;
 
+    private List<String> interfaces;
+
     private ApplicationId routerAppId;
 
     // Reference count for how many times a next hop is used by a route
@@ -161,15 +165,29 @@
         log.info("Control Plane Connect Point: {}", controlPlaneConnectPoint);
 
         deviceId = routerConfig.getControlPlaneConnectPoint().deviceId();
-
         log.info("Router device ID is {}", deviceId);
 
+        interfaces = routerConfig.getInterfaces();
+        log.info("Using interfaces: {}", interfaces.isEmpty() ? "all" : interfaces);
+
         updateDevice();
     }
 
     private void updateDevice() {
         if (deviceId != null && deviceService.isAvailable(deviceId)) {
-            processIntfFilters(true, interfaceService.getInterfaces());
+
+            Set<Interface> intfs;
+            if (interfaces.isEmpty()) {
+                intfs = interfaceService.getInterfaces();
+            } else {
+                // TODO need to fix by making interface names globally unique
+                intfs = interfaceService.getInterfaces().stream()
+                        .filter(intf -> intf.connectPoint().deviceId().equals(deviceId))
+                        .filter(intf -> interfaces.contains(intf.name()))
+                        .collect(Collectors.toSet());
+            }
+
+            processIntfFilters(true, intfs);
         }
     }