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.
16 package org.onosproject.net.flow.criteria;
18 import static com.google.common.base.MoreObjects.toStringHelper;
19 import static com.google.common.base.Preconditions.checkNotNull;
21 import java.util.Objects;
23 import org.onosproject.net.OduSignalType;
26 * Implementation of ODU (Optical channel Data Unit) signal Type criterion.
27 * This criterion is based on the specification of "OFPXMT_EXP_ODU_SIGTYPE" in
28 * Open Networking Foundation "Optical Transport Protocol Extension Version 1.0", but
29 * defined in protocol agnostic way.
31 public final class OduSignalTypeCriterion implements Criterion {
33 private final OduSignalType signalType;
36 * Create an instance with the specified ODU signal Type.
38 * @param signalType - ODU signal Type
40 OduSignalTypeCriterion(OduSignalType signalType) {
41 this.signalType = checkNotNull(signalType);
46 return Type.ODU_SIGTYPE;
50 * Returns the ODU Signal Type to match.
52 * @return the ODU signal Type to match
54 public OduSignalType signalType() {
59 public int hashCode() {
60 return Objects.hash(type(), signalType);
64 public boolean equals(Object obj) {
68 if (!(obj instanceof OduSignalTypeCriterion)) {
71 final OduSignalTypeCriterion that = (OduSignalTypeCriterion) obj;
72 return Objects.equals(this.signalType, that.signalType);
76 public String toString() {
77 return toStringHelper(type().toString())
78 .add("signalType", signalType)