blob: 7ac70ab16e51a121c68f1ae981ecf6d7c03b27e4 [file] [log] [blame]
Pier Ventre6f630052016-10-18 09:58:41 -07001/*
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
17package org.onosproject.driver.extensions;
18
19import com.google.common.base.MoreObjects;
20import org.onlab.packet.VlanId;
21import org.onosproject.net.flow.criteria.ExtensionSelectorType;
22
23import 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 */
29public 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 Ventre4ff01342016-11-19 21:14:30 -080067 if (obj != null && obj.getClass() == Ofdpa3MatchOvid.class) {
Pier Ventre6f630052016-10-18 09:58:41 -070068 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}