Pier Ventre | 6f63005 | 2016-10-18 09:58:41 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.driver.extensions; |
| 18 | |
| 19 | import com.google.common.base.MoreObjects; |
| 20 | import org.onlab.packet.VlanId; |
| 21 | import org.onosproject.net.flow.criteria.ExtensionSelectorType; |
| 22 | |
| 23 | import java.util.Objects; |
| 24 | |
| 25 | /** |
| 26 | * OFDPA OVID extension match. OVID is a meta-data of the OFDPA |
| 27 | * pipeline, but basically it is a VLAN ID. |
| 28 | */ |
| 29 | public class Ofdpa3MatchOvid extends OfdpaMatchVlanVid { |
| 30 | |
| 31 | /** |
| 32 | * Constructs a new match OVID instruction. |
| 33 | */ |
| 34 | protected Ofdpa3MatchOvid() { |
| 35 | super(); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Constructs a new match OVID instruction with a given VLAN ID. |
| 40 | * |
| 41 | * @param vlanId VLAN ID |
| 42 | */ |
| 43 | public Ofdpa3MatchOvid(VlanId vlanId) { |
| 44 | super(vlanId); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Returns the treatment type. |
| 49 | * |
| 50 | * @return the match OVID extension type |
| 51 | */ |
| 52 | @Override |
| 53 | public ExtensionSelectorType type() { |
| 54 | return ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_OVID.type(); |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public int hashCode() { |
| 59 | return Objects.hash(this.vlanId()); |
| 60 | } |
| 61 | |
| 62 | @Override |
| 63 | public boolean equals(Object obj) { |
| 64 | if (this == obj) { |
| 65 | return true; |
| 66 | } |
Pier Ventre | 4ff0134 | 2016-11-19 21:14:30 -0800 | [diff] [blame] | 67 | if (obj != null && obj.getClass() == Ofdpa3MatchOvid.class) { |
Pier Ventre | 6f63005 | 2016-10-18 09:58:41 -0700 | [diff] [blame] | 68 | Ofdpa3MatchOvid that = (Ofdpa3MatchOvid) obj; |
| 69 | return Objects.equals(this.vlanId(), that.vlanId()); |
| 70 | |
| 71 | } |
| 72 | return false; |
| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public String toString() { |
| 77 | return MoreObjects.toStringHelper(getClass()) |
| 78 | .add("oVid", this.vlanId()) |
| 79 | .toString(); |
| 80 | } |
| 81 | |
| 82 | } |