20c3193b1313707b56df58b4d134cc50b8a6cbd4
[ccsdk/features.git] /
1 /*******************************************************************************
2  * ============LICENSE_START========================================================================
3  * ONAP : ccsdk feature sdnr wt
4  * =================================================================================================
5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6  * =================================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8  * in compliance with the License. You may obtain a copy of the License at
9  * 
10  * http://www.apache.org/licenses/LICENSE-2.0
11  * 
12  * Unless required by applicable law or agreed to in writing, software distributed under the License
13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14  * or implied. See the License for the specific language governing permissions and limitations under
15  * the License.
16  * ============LICENSE_END==========================================================================
17  ******************************************************************************/
18 /**
19  * @author herbert
20  *
21  */
22 package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes;
23
24 public enum InternalSeverity {
25
26         NonAlarmed,
27         Warning,
28         Minor,
29         Major,
30         Critical;
31
32     public boolean isNoAlarmIndication() {
33         return this == NonAlarmed;
34     }
35
36     public String getValueAsString() {
37         return this.name();
38     }
39
40     @Override
41     public String toString() {
42         return this.name();
43     }
44
45     public String toNetconfString()
46     {
47         switch(this)
48         {
49         case NonAlarmed:
50             return "non-alarmed";
51         case Warning:
52             return "warning";
53         case Minor:
54             return "minor";
55         case Major:
56             return "major";
57         case Critical:
58             return "critical";
59         }
60         return "not-specified";
61     }
62
63     /**
64      * convert ONF 1.2 Severity
65      * @param severity as input
66      * @return String with related output
67      */
68     public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType severity ) {
69         switch( severity ) {
70             case NonAlarmed:
71                 return InternalSeverity.NonAlarmed;
72             case Warning:
73                 return InternalSeverity.Warning;
74             case Minor:
75                 return InternalSeverity.Minor;
76             case Major:
77                 return InternalSeverity.Major;
78             case Critical:
79                 return InternalSeverity.Critical;
80         }
81         return null;
82     }
83
84     /**
85      * convert ONF 1.2.1.1 Severity
86      * @param severity as input
87      * @return String with related output
88      */
89     public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType severity ) {
90         switch( severity ) {
91             case NonAlarmed:
92                 return InternalSeverity.NonAlarmed;
93             case Warning:
94                 return InternalSeverity.Warning;
95             case Minor:
96                 return InternalSeverity.Minor;
97             case Major:
98                 return InternalSeverity.Major;
99             case Critical:
100                 return InternalSeverity.Critical;
101         }
102         return null;
103     }
104
105     /**
106      * convert ONF 1.2.1.1p Severity
107      * @param severity as input
108      * @return String with related output
109      */
110     public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType severity ) {
111         switch( severity ) {
112             case NonAlarmed:
113                 return InternalSeverity.NonAlarmed;
114             case Warning:
115                 return InternalSeverity.Warning;
116             case Minor:
117                 return InternalSeverity.Minor;
118             case Major:
119                 return InternalSeverity.Major;
120             case Critical:
121                 return InternalSeverity.Critical;
122         }
123         return null;
124     }
125 }