536bb04fcea115bbce1126f8865914c8e7f28c06
[so.git] / common / src / main / java / org / onap / so / beans / nsmf / oof / SubnetType.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  # Copyright (c) 2020, CMCC Technologies Co., Ltd.
6  #
7  # Licensed under the Apache License, Version 2.0 (the "License")
8  # you may not use this file except in compliance with the License.
9  # You may obtain a copy of the License at
10  #
11  #       http://www.apache.org/licenses/LICENSE-2.0
12  #
13  # Unless required by applicable law or agreed to in writing, software
14  # distributed under the License is distributed on an "AS IS" BASIS,
15  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  # See the License for the specific language governing permissions and
17  # limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.beans.nsmf.oof;
21
22 import lombok.Getter;
23 import org.onap.so.beans.nsmf.NetworkType;
24
25 @Getter
26 public enum SubnetType {
27     AN("AN", NetworkType.ACCESS),
28
29     CN("CN", NetworkType.CORE),
30
31     TN_FH("TN_FH", NetworkType.TRANSPORT),
32
33     TN_MH("TN_MH", NetworkType.TRANSPORT),
34
35     TN_BH("TN_BH", NetworkType.TRANSPORT),;
36
37     private NetworkType networkType;
38
39     private String subnetType;
40
41     SubnetType(String subnetType, NetworkType networkType) {
42         this.subnetType = subnetType;
43         this.networkType = networkType;
44     }
45
46     public static NetworkType getNetworkType(String subnetType) {
47         for (SubnetType type : SubnetType.values()) {
48             if (type.subnetType.equalsIgnoreCase(subnetType)) {
49                 return type.networkType;
50             }
51         }
52         return null;
53     }
54 }