blob: 491d98647d6bf72e906b2ace971b9a1f073e0791 [file] [log] [blame]
Toshio Koide80db1842014-08-11 17:08:32 -07001package net.onrc.onos.core.matchaction.action;
2
Toshio Koidebf8f8652014-08-19 16:34:24 -07003import static com.google.common.base.Preconditions.checkNotNull;
Toshio Koide80db1842014-08-11 17:08:32 -07004import net.floodlightcontroller.util.MACAddress;
5
Toshio Koidebf8f8652014-08-19 16:34:24 -07006import com.google.common.base.Objects;
7
Toshio Koide80db1842014-08-11 17:08:32 -07008/**
9 * An action object to modify destination MAC address.
10 * <p>
11 * This class does not have a switch ID. The switch ID is handled by
Toshio Koide7894ca02014-08-15 14:30:13 -070012 * MatchAction, Flow or Intent class.
Toshio Koide80db1842014-08-11 17:08:32 -070013 */
14public class ModifyDstMacAction implements Action {
15 private final MACAddress dstMac;
16
17 /**
18 * Constructor.
19 *
20 * @param dstMac destination MAC address after the modification
21 */
22 public ModifyDstMacAction(MACAddress dstMac) {
Toshio Koidebf8f8652014-08-19 16:34:24 -070023 this.dstMac = checkNotNull(dstMac);
Toshio Koide80db1842014-08-11 17:08:32 -070024 }
25
26 /**
27 * Gets the destination MAC address.
28 *
29 * @return the destination MAC address
30 */
31 public MACAddress getDstMac() {
32 return dstMac;
33 }
34
Toshio Koidebf8f8652014-08-19 16:34:24 -070035 @Override
36 public int hashCode() {
37 return Objects.hashCode(dstMac);
38 }
39
40 @Override
41 public boolean equals(Object obj) {
42 if (this == obj) {
43 return true;
44 }
45 if (obj == null || getClass() != obj.getClass()) {
46 return false;
47 }
48 ModifyDstMacAction that = (ModifyDstMacAction) obj;
49 return Objects.equal(this.dstMac, that.dstMac);
50 }
Toshio Koide80db1842014-08-11 17:08:32 -070051}