2 * Copyright 2014-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.
16 package org.onosproject.net.flow.instructions;
18 import org.onosproject.net.OduSignalId;
20 import static com.google.common.base.MoreObjects.toStringHelper;
22 import java.util.Objects;
24 public abstract class L1ModificationInstruction implements Instruction {
27 * Represents the type of traffic treatment.
29 public enum L1SubType {
31 * ODU (Optical channel Data Unit) Signal Id modification.
36 public abstract L1SubType subtype();
39 public final Type type() {
40 return Type.L1MODIFICATION;
44 * Represents an L1 ODU (Optical channel Data Unit) Signal Id modification instruction.
46 public static final class ModOduSignalIdInstruction extends L1ModificationInstruction {
48 private final OduSignalId oduSignalId;
50 ModOduSignalIdInstruction(OduSignalId oduSignalId) {
51 this.oduSignalId = oduSignalId;
55 public L1SubType subtype() {
56 return L1SubType.ODU_SIGID;
59 public OduSignalId oduSignalId() {
64 public int hashCode() {
65 return Objects.hash(oduSignalId);
69 public boolean equals(Object obj) {
73 if (!(obj instanceof ModOduSignalIdInstruction)) {
76 final ModOduSignalIdInstruction that = (ModOduSignalIdInstruction) obj;
77 return Objects.equals(this.oduSignalId, that.oduSignalId);
81 public String toString() {
82 return toStringHelper(this)
83 .add("oduSignalId", oduSignalId)