Reorganize mappingservice.implementation
[lispflowmapping.git] / mappingservice / yangmodel / src / main / java / org / opendaylight / lispflowmapping / lisp / type / LispCanonicalAddressFormatEnum.java
1 /*
2  * Copyright (c) 2014 Contextream, Inc. 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.lispflowmapping.lisp.type;
10
11 /**
12  * The LCAF enum. http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03
13  */
14 public enum LispCanonicalAddressFormatEnum {
15     LIST(1), //
16     SEGMENT(2), //
17     APPLICATION_DATA(4), //
18     SOURCE_DEST(12), //
19     TRAFFIC_ENGINEERING(10), //
20     KEY_VALUE(15), //
21     UNKNOWN(-1);
22
23     private byte lispCode;
24
25     private LispCanonicalAddressFormatEnum(int lispCode) {
26         this.lispCode = (byte) lispCode;
27     }
28
29     public byte getLispCode() {
30         return lispCode;
31     }
32
33     public static LispCanonicalAddressFormatEnum valueOf(int lispCode) {
34         for (LispCanonicalAddressFormatEnum val : values()) {
35             if (val.getLispCode() == lispCode) {
36                 return val;
37             }
38         }
39         return UNKNOWN;
40     }
41 }