Add method to create LinkKey for LinkDescription
Change-Id: Iaf8854d349ecd89ae901b76a38f173512eaacb63
diff --git a/core/api/src/main/java/org/onosproject/net/LinkKey.java b/core/api/src/main/java/org/onosproject/net/LinkKey.java
index 5a37930..0b0d5fb 100644
--- a/core/api/src/main/java/org/onosproject/net/LinkKey.java
+++ b/core/api/src/main/java/org/onosproject/net/LinkKey.java
@@ -19,6 +19,8 @@
import java.util.Objects;
+import org.onosproject.net.link.LinkDescription;
+
import com.google.common.base.MoreObjects;
// TODO Consider renaming.
@@ -82,6 +84,16 @@
return new LinkKey(link.src(), link.dst());
}
+ /**
+ * Creates a link identifier for the specified link.
+ *
+ * @param link {@link Description}
+ * @return a link identifier
+ */
+ public static LinkKey linkKey(LinkDescription link) {
+ return new LinkKey(link.src(), link.dst());
+ }
+
@Override
public int hashCode() {
return Objects.hash(src, dst);