Add API to look up interface by name

Change-Id: I03fcae92e83f5b804bca21a105d4d1ee8295f2ad
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java
index 38cfdc5..bfe2ec7 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java
@@ -39,6 +39,15 @@
     Set<Interface> getInterfaces();
 
     /**
+     * Returns the interface with the given name.
+     *
+     * @param connectPoint connect point of the interface
+     * @param name name of the interface
+     * @return interface if it exists, otherwise null
+     */
+    Interface getInterfaceByName(ConnectPoint connectPoint, String name);
+
+    /**
      * Returns the set of interfaces configured on the given port.
      *
      * @param port connect point
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/InterfaceManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/InterfaceManager.java
index 7edbf25..9da2177 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/InterfaceManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/InterfaceManager.java
@@ -102,6 +102,17 @@
     }
 
     @Override
+    public Interface getInterfaceByName(ConnectPoint connectPoint, String name) {
+        Optional<Interface> intf =
+                interfaces.getOrDefault(connectPoint, Collections.emptySet())
+                .stream()
+                .filter(i -> i.name().equals(name))
+                .findAny();
+
+        return intf.isPresent() ? intf.get() : null;
+    }
+
+    @Override
     public Set<Interface> getInterfacesByPort(ConnectPoint port) {
         Set<Interface> intfs = interfaces.get(port);
         if (intfs == null) {