Merge "Added support in neutron and it utils for SGs"
[netvirt.git] / vpnservice / fibmanager / fibmanager-impl / src / main / java / org / opendaylight / netvirt / fibmanager / L3VPNTransportTypes.java
1 /*
2  * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.netvirt.fibmanager;
10
11 import org.opendaylight.genius.itm.globals.ITMConstants;
12 import java.util.HashMap;
13 import java.util.Map;
14
15
16 public enum L3VPNTransportTypes {
17     VxLAN   (ITMConstants.TUNNEL_TYPE_VXLAN),
18     GRE     (ITMConstants.TUNNEL_TYPE_GRE),
19     Invalid (ITMConstants.TUNNEL_TYPE_INVALID);
20
21     private String transportType;
22
23     L3VPNTransportTypes (String type) {
24         transportType = type;
25     }
26     public void setL3VPNTransportTypes(String transportType) {
27         this.transportType = transportType;
28     }
29
30     private static final Map<String, L3VPNTransportTypes> strToTypeMap = new HashMap<String, L3VPNTransportTypes>();
31     static {
32         for (L3VPNTransportTypes type : L3VPNTransportTypes.values()) {
33             strToTypeMap.put(type.transportType, type);
34         }
35     }
36
37     public String getTransportType() {
38         return this.transportType;
39     }
40
41     public static L3VPNTransportTypes validateTransportType(String transportType) {
42         L3VPNTransportTypes type = strToTypeMap.get(transportType);
43         if (type == null)
44             return L3VPNTransportTypes.Invalid;
45         return type;
46     }
47 }