2 * Copyright © 2017 Red Hat, Inc. and others.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.genius.mdsalutil.matches;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
17 * Ethernet type match.
19 public class MatchEthernetType extends MatchInfoHelper<EthernetMatch, EthernetMatchBuilder> {
20 public static final MatchEthernetType IPV4 = new MatchEthernetType(0x0800L);
21 public static final MatchEthernetType ARP = new MatchEthernetType(0x0806L);
22 public static final MatchEthernetType RARP = new MatchEthernetType(0x8035L);
23 public static final MatchEthernetType IPV6 = new MatchEthernetType(0x86DDL);
24 public static final MatchEthernetType MPLS_UNICAST = new MatchEthernetType(0x8847L);
25 public static final MatchEthernetType MPLS_MULTICAST = new MatchEthernetType(0x8848L);
27 private final long type;
29 public MatchEthernetType(long type) {
34 protected void applyValue(MatchBuilder matchBuilder, EthernetMatch value) {
35 matchBuilder.setEthernetMatch(value);
39 protected void populateBuilder(EthernetMatchBuilder builder) {
40 builder.setEthernetType(new EthernetTypeBuilder().setType(new EtherType(type)).build());
43 public long getType() {
48 public boolean equals(Object o) {
49 if (this == o) return true;
50 if (o == null || getClass() != o.getClass()) return false;
51 if (!super.equals(o)) return false;
53 MatchEthernetType that = (MatchEthernetType) o;
55 return type == that.type;
59 public int hashCode() {
60 int result = super.hashCode();
61 result = 31 * result + (int) (type ^ (type >>> 32));