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.OduSignalId;
26 * Implementation of ODU (Optical channel Data Unit) signal ID signal criterion.
27 * This criterion is based on the specification of "OFPXMT_EXP_ODU_SIGID" in
28 * Open Networking Foundation "Optical Transport Protocol Extension Version 1.0", but
29 * defined in protocol agnostic way.
31 public final class OduSignalIdCriterion implements Criterion {
33 private final OduSignalId oduSignalId;
36 * Create an instance with the specified ODU signal ID.
38 * @param oduSignalId - ODU signal ID
40 OduSignalIdCriterion(OduSignalId oduSignalId) {
41 this.oduSignalId = checkNotNull(oduSignalId);
46 return Type.ODU_SIGID;
50 * Returns the ODU Signal to match.
52 * @return the ODU signal to match
54 public OduSignalId oduSignalId() {
59 public int hashCode() {
60 return Objects.hash(type(), oduSignalId);
64 public boolean equals(Object obj) {
68 if (!(obj instanceof OduSignalIdCriterion)) {
71 final OduSignalIdCriterion that = (OduSignalIdCriterion) obj;
72 return Objects.equals(this.oduSignalId, that.oduSignalId);
76 public String toString() {
77 return toStringHelper(type().toString())
78 .add("oduSignalId", oduSignalId)