2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
10 import com.google.common.collect.ImmutableMap;
11 import com.google.common.collect.ImmutableMap.Builder;
18 //TODO make a model in YANG for protocols
19 public enum IPProtocols {
25 private short protocol;
27 private static final Map<Short, IPProtocols> VALUE_MAP;
29 Builder<Short, IPProtocols> builder = ImmutableMap.builder();
30 for(IPProtocols protocols : IPProtocols.values()) {
31 builder.put(protocols.protocol, protocols);
33 VALUE_MAP = builder.build();
36 private IPProtocols(short value) {
37 this.protocol = value;
40 public static IPProtocols fromProtocolNum(Short protocolNum) {
41 return VALUE_MAP.get(protocolNum);