blob: a6c1dba5e8ff2ad21d7fa5ee05ecd0d9b101327b [file] [log] [blame]
Henry Yu4b4a7eb2016-11-09 20:07:53 -05001/*
2 * Copyright 2016 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.tetopology.management.api;
17
18/**
19 * Type of switching on a link.
20 * See RFC 3471 for details.
21 */
22public enum SwitchingType {
23
24 /**
25 * Designates packet-switch capable-1 (PSC-1).
26 */
27 PACKET_SWITCH_CAPABLE1(1),
28
29 /**
30 * Designates packet-switch capable-2 (PSC-2).
31 */
32 PACKET_SWITCH_CAPABLE2(2),
33
34 /**
35 * Designates packet-switch capable-3 (PSC-3).
36 */
37 PACKET_SWITCH_CAPABLE3(3),
38
39 /**
40 * Designates packet-switch capable-4 (PSC-4).
41 */
42 PACKET_SWITCH_CAPABLE4(4),
43
44 /**
45 * Designates ethernet virtual private line (EVPL).
46 */
47 ETHERNET_VIRTUAL_PRIVATE_LINE(5),
48
49 /**
50 * Designates layer-2 switch capable (L2SC).
51 */
52 LAYER2_SWITCH_CAPABLE(51),
53
54 /**
55 * Designates time-division-multiplex capable (TDM).
56 */
57 TIME_DIVISION_MULTIPLEX_CAPABLE(100),
58
59 /**
60 * Designates OTN-TDM capable.
61 */
62 OTN_TDM_CAPABLE(101),
63
64 /**
65 * Designates lambda-switch capable (LSC).
66 */
67 LAMBDA_SWITCH_CAPABLE(150),
68
69 /**
70 * Designates fiber-switch capable (FSC).
71 */
72 FIBER_SWITCH_CAPABLE(200);
73
74 private int value;
75
76 /**
77 * Creates an instance of a switching type constant corresponding
78 * to the given integer value.
79 *
80 * @param value integer value
81 */
82 SwitchingType(int value) {
83 this.value = value;
84 }
85
86 /**
87 * Returns the integer value of the switching type.
88 *
89 * @return integer value
90 */
91 public int value() {
92 return value;
93 }
94
95 /**
96 * Returns the switching type corresponding to a given integer
97 * value. If the given value is not valid, a null is returned.
98 *
99 * @param value integer value
100 * @return corresponding switching type; or null if value is invalid
101 */
102 public static SwitchingType of(int value) {
103 switch (value) {
104 case 1:
105 return PACKET_SWITCH_CAPABLE1;
106 case 2:
107 return PACKET_SWITCH_CAPABLE2;
108 case 3:
109 return PACKET_SWITCH_CAPABLE3;
110 case 4:
111 return PACKET_SWITCH_CAPABLE4;
112 case 5:
113 return ETHERNET_VIRTUAL_PRIVATE_LINE;
114 case 51:
115 return LAYER2_SWITCH_CAPABLE;
116 case 100:
117 return TIME_DIVISION_MULTIPLEX_CAPABLE;
118 case 101:
119 return OTN_TDM_CAPABLE;
120 case 150:
121 return LAMBDA_SWITCH_CAPABLE;
122 case 200:
123 return FIBER_SWITCH_CAPABLE;
124 default:
125 return null;
126 }
127 }
128}