Fix license header violations in openflowplugin-api
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / md / util / OpenflowVersion.java
1 /*
2  * Copyright (c) 2014, 2015 Cisco Systems, 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.openflowplugin.api.openflow.md.util;
10
11 /**
12  * @deprecated enum in api is not something what we would like to see in case it is evolving
13  * TODO: remove class for lithium release
14  *
15  * List of Openflow versions supported by the plugin
16  * Note: If you add a version here, make sure to update org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil as well.
17  * Created by kramesha on 5/2/14.
18  */
19 public enum OpenflowVersion {
20
21     OF10((short)0x01),
22     OF13((short)0x04),
23     UNSUPPORTED((short)0x00);
24
25
26     private short version;
27
28     OpenflowVersion(final short version) {
29         this.version = version;
30     }
31
32     public static OpenflowVersion get(final Short version) {
33         for (final OpenflowVersion ofv : OpenflowVersion.values()) {
34             if (ofv.version == version) {
35                 return ofv;
36             }
37         }
38         return UNSUPPORTED;
39     }
40
41     /**
42      * @return the version
43      */
44     public short getVersion() {
45         return version;
46     }
47
48 }