blob: 4e1be18dcbaf645e819a92a2a44b965fd5e834f7 [file] [log] [blame]
Satish Kf6d87cb2015-11-30 19:59:22 +05301/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.iptopology.api;
17
Priyanka B8c378582015-12-07 21:09:56 +053018import java.util.HashMap;
19import java.util.Map;
20
Satish Kf6d87cb2015-11-30 19:59:22 +053021/**
22 * Abstraction of Router ID to identify the router with a distinct IP address.
23 */
24public interface RouteIdentifier {
25 /**
26 * Enum to provide Protocol type.
27 */
28 public enum ProtocolType {
29 ISIS_LevelOne(1), ISIS_LevelTwo(2), OSPFv2(3), Direct(4), Static_Configuration(5), OSPFv3(6);
30 int value;
31
32 /**
33 * Sets protocol ID.
34 *
35 * @param val protocol ID
36 */
37 ProtocolType(int val) {
38 value = val;
39 }
40
Priyanka B8c378582015-12-07 21:09:56 +053041 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
Satish Kf6d87cb2015-11-30 19:59:22 +053059 /**
60 * Provides Protocol ID.
61 *
62 * @return Protocol ID
63 */
64 public byte getType() {
65 return (byte) value;
66 }
67 }
68
69 /**
70 * Provides Protocol ID to identify which protocol routing instance is used.
71 *
72 * @return Protocol type
73 */
74 ProtocolType type();
75}