Route Identifier
Change-Id: I22a00f56998849e406481d816f09171212da932f
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/RouteIdentifier.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/RouteIdentifier.java
index 73cda7a..4e1be18 100644
--- a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/RouteIdentifier.java
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/RouteIdentifier.java
@@ -15,6 +15,9 @@
*/
package org.onosproject.iptopology.api;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* Abstraction of Router ID to identify the router with a distinct IP address.
*/
@@ -35,6 +38,24 @@
value = val;
}
+ static Map<Integer, ProtocolType> map = new HashMap<>();
+
+ static {
+ for (ProtocolType type : ProtocolType.values()) {
+ map.put(type.value, type);
+ }
+ }
+
+ /**
+ * A method that returns enum value.
+ *
+ * @param value protocol type
+ * @return Enum value
+ */
+ public static ProtocolType getEnumType(int value) {
+ return map.get(value);
+ }
+
/**
* Provides Protocol ID.
*