Priyanka B
Committed by Gerrit Code Review

Route Identifier

Change-Id: I22a00f56998849e406481d816f09171212da932f
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
15 */ 15 */
16 package org.onosproject.iptopology.api; 16 package org.onosproject.iptopology.api;
17 17
18 +import java.util.HashMap;
19 +import java.util.Map;
20 +
18 /** 21 /**
19 * Abstraction of Router ID to identify the router with a distinct IP address. 22 * Abstraction of Router ID to identify the router with a distinct IP address.
20 */ 23 */
...@@ -35,6 +38,24 @@ public interface RouteIdentifier { ...@@ -35,6 +38,24 @@ public interface RouteIdentifier {
35 value = val; 38 value = val;
36 } 39 }
37 40
41 + static Map<Integer, ProtocolType> map = new HashMap<>();
42 +
43 + static {
44 + for (ProtocolType type : ProtocolType.values()) {
45 + map.put(type.value, type);
46 + }
47 + }
48 +
49 + /**
50 + * A method that returns enum value.
51 + *
52 + * @param value protocol type
53 + * @return Enum value
54 + */
55 + public static ProtocolType getEnumType(int value) {
56 + return map.get(value);
57 + }
58 +
38 /** 59 /**
39 * Provides Protocol ID. 60 * Provides Protocol ID.
40 * 61 *
......