blob: 356a8534da6f15eee95862a77a16c7f4ae0ad399 [file] [log] [blame]
Aihua Guo1ce2dd12016-08-12 23:37:44 -04001/*
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 */
16
Henry Yu4b4a7eb2016-11-09 20:07:53 -050017package org.onosproject.tetopology.management.api;
Aihua Guo1ce2dd12016-08-12 23:37:44 -040018
19/**
20 * Represents ENUM data of teStatus.
21 */
22public enum TeStatus {
23
24 /**
25 * Represents up.
26 */
27 UP(0),
28
29 /**
30 * Represents down.
31 */
32 DOWN(1),
33
34 /**
35 * Represents testing.
36 */
37 TESTING(2),
38
39 /**
40 * Represents preparingMaintenance.
41 */
42 PREPARING_MAINTENANCE(3),
43
44 /**
45 * Represents maintenance.
46 */
47 MAINTENANCE(4),
48
49 /**
50 * Status cannot be determined for some reason.
51 */
52 UNKNOWN(5);
53
54 private int teStatus;
55
56 /**
57 * Creates an instance of teStatus.
58 *
59 * @param value value of teStatus
60 */
61 TeStatus(int value) {
62 teStatus = value;
63 }
64
65 /**
66 * Returns the attribute teStatus.
67 *
68 * @return value of teStatus
69 */
70 public int teStatus() {
71 return teStatus;
72 }
73
74 /**
Aihua Guo1ce2dd12016-08-12 23:37:44 -040075 * Returns the object of teAdminStatusEnumForTypeInt.Returns null
76 * when string conversion fails or converted integer value is not
77 * recognized.
78 *
79 * @param value value of teAdminStatusEnumForTypeInt
80 * @return Object of teAdminStatusEnumForTypeInt
81 */
82 public static TeStatus of(int value) {
83 switch (value) {
84 case 0:
85 return TeStatus.UP;
86 case 1:
87 return TeStatus.DOWN;
88 case 2:
89 return TeStatus.TESTING;
90 case 3:
91 return TeStatus.PREPARING_MAINTENANCE;
92 case 4:
93 return TeStatus.MAINTENANCE;
94 case 5:
95 return TeStatus.UNKNOWN;
96 default :
97 return null;
98 }
99 }
100}