blob: 027a50ef3ddbfcf13b82638256ec5b1ef5657e07 [file] [log] [blame]
sunishvka1dfc3e2016-04-16 12:24:47 +05301/*
2 * Copyright 2016-present 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.isis.io.isispacket.tlv.subtlv;
17
18import java.util.EnumSet;
19import java.util.HashMap;
20import java.util.Map;
21
22/**
23 * Representation of sub tlv type.
24 */
25public enum SubTlvType {
PRASHANTH SHIVANANJAPPA491b8af2016-04-27 19:23:24 +053026 /**
27 * Represents traffic engineering administrative group TLV.
28 */
29 ADMINISTRATIVEGROUP(3),
30 /**
31 * Represents traffic engineering maximum bandwidth TLV.
32 */
33 MAXIMUMBANDWIDTH(9),
34 /**
35 * Represents traffic engineering maximum reservable bandwidth TLV.
36 */
37 MAXIMUMRESERVABLEBANDWIDTH(10),
38 /**
39 * Represents traffic engineering metric TLV.
40 */
41 TRAFFICENGINEERINGMETRIC(18),
42 /**
43 * Represents traffic engineering interface address TLV.
44 */
45 INTERFACEADDRESS(6),
46 /**
sunish vk7bdf4d42016-06-24 12:29:43 +053047 * Represents traffic engineering neighbor address TLV.
48 */
49 NEIGHBORADDRESS(8),
50 /**
PRASHANTH SHIVANANJAPPA491b8af2016-04-27 19:23:24 +053051 * Represents traffic engineering unreserved bandwidth TLV.
52 */
53 UNRESERVEDBANDWIDTH(11);
sunishvka1dfc3e2016-04-16 12:24:47 +053054
55 // Reverse lookup table
56 private static final Map<Integer, SubTlvType> LOOKUP = new HashMap<>();
57
58 // Populate the lookup table on loading time
59 static {
60 for (SubTlvType subTlvType : EnumSet.allOf(SubTlvType.class)) {
61 LOOKUP.put(subTlvType.value(), subTlvType);
62 }
63 }
64
65 private int value;
66
67 /**
68 * Sets the sub TLV type value.
69 *
70 * @param value value.
71 */
72 SubTlvType(int value) {
73 this.value = value;
74 }
75
76 /**
Dhruv Dhodye64b93e2016-04-20 19:26:55 +053077 * Returns the enum instance from type value - reverse lookup purpose.
sunishvka1dfc3e2016-04-16 12:24:47 +053078 *
79 * @param subTlvTypeValue TLV type value
80 * @return ISIS sub TLV type instance
81 */
82 public static SubTlvType get(int subTlvTypeValue) {
83 return LOOKUP.get(subTlvTypeValue);
84 }
85
86 /**
Dhruv Dhodye64b93e2016-04-20 19:26:55 +053087 * Returns value.
sunishvka1dfc3e2016-04-16 12:24:47 +053088 *
89 * @return value
90 */
91 public int value() {
92 return value;
93 }
94}