Add feature to Support NSMF based TN slices
[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     AN_NF("AN_NF", NetworkType.ACCESS),
30
31     CN("CN", NetworkType.CORE),
32
33     TN_FH("TN_FH", NetworkType.TRANSPORT),
34
35     TN_MH("TN_MH", NetworkType.TRANSPORT),
36
37     TN_BH("TN_BH", NetworkType.TRANSPORT),;
38
39     private NetworkType networkType;
40
41     private String subnetType;
42
43     SubnetType(String subnetType, NetworkType networkType) {
44         this.subnetType = subnetType;
45         this.networkType = networkType;
46     }
47
48     public static NetworkType getNetworkType(String subnetType) {
49         for (SubnetType type : SubnetType.values()) {
50             if (type.subnetType.equalsIgnoreCase(subnetType)) {
51                 return type.networkType;
52             }
53         }
54         return null;
55     }
56 }