2 * Copyright 2015 Open Networking Laboratory
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onosproject.net.flow.instructions;
19 import com.google.common.annotations.Beta;
20 import com.google.common.base.MoreObjects;
22 import java.util.Objects;
25 * Type of extension instructions.
28 public final class ExtensionTreatmentType {
31 * A list of well-known named extension instruction type codes.
32 * These numbers have no impact on the actual OF type id.
34 public enum ExtensionTreatmentTypes {
35 // TODO fix type numbers to include experimenter id
36 NICIRA_SET_TUNNEL_DST(0),
38 NICIRA_SET_NSH_SPI(32);
40 private ExtensionTreatmentType type;
43 * Creates a new named extension instruction type.
45 * @param type type code
47 ExtensionTreatmentTypes(int type) {
48 this.type = new ExtensionTreatmentType(type);
52 * Gets the extension type object for this named type code.
54 * @return extension type object
56 public ExtensionTreatmentType type() {
61 private final int type;
64 * Creates an extension type with the given int type code.
66 * @param type type code
68 public ExtensionTreatmentType(int type) {
73 public int hashCode() {
74 return Objects.hash(type);
78 public boolean equals(Object obj) {
82 if (obj instanceof ExtensionTreatmentType) {
83 final ExtensionTreatmentType that = (ExtensionTreatmentType) obj;
84 return this.type == that.type;
90 public String toString() {
91 return MoreObjects.toStringHelper(ExtensionTreatmentType.class)