2 * Copyright (c) 2016 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
9 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common;
11 import com.google.common.collect.ImmutableMap;
12 import com.google.common.collect.ImmutableMap.Builder;
19 //TODO make a model in YANG for protocols
20 public enum IPProtocols {
26 private short protocol;
28 private static final Map<Short, IPProtocols> VALUE_MAP;
30 Builder<Short, IPProtocols> builder = ImmutableMap.builder();
31 for(IPProtocols protocols : IPProtocols.values()) {
32 builder.put(protocols.protocol, protocols);
34 VALUE_MAP = builder.build();
37 private IPProtocols(short value) {
38 this.protocol = value;
41 public static IPProtocols fromProtocolNum(Short protocolNum) {
42 return VALUE_MAP.get(protocolNum);