2 * Copyright (c) 2019 Alten Calsoft Labs India Pvt Ltd. and others. All rights reserved.
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.actions;
10 import org.opendaylight.genius.mdsalutil.ActionInfo;
11 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
20 * Set IPv6 ND TarAbstractClusteredAsyncDataTreeChangeListenerget action.
22 public class ActionSetIpv6NdTarget extends ActionInfo {
24 private final Ipv6Address ndTarget;
27 public ActionSetIpv6NdTarget(Ipv6Address ndTarget) {
31 public ActionSetIpv6NdTarget(int actionKey, Ipv6Address ndTarget) {
33 this.ndTarget = ndTarget;
37 public Action buildAction() {
38 return buildAction(getActionKey());
42 public Action buildAction(int newActionKey) {
43 return new ActionBuilder()
44 .setAction(new SetFieldCaseBuilder()
45 .setSetField(new SetFieldBuilder()
46 .setLayer3Match(new Ipv6MatchBuilder()
47 .setIpv6NdTarget(new Ipv6Address(ndTarget)).build())
50 .withKey(new ActionKey(newActionKey))
54 public Ipv6Address getNdTarget() {
59 public boolean equals(Object other) {
63 if (other == null || getClass() != other.getClass()) {
66 if (!super.equals(other)) {
70 ActionSetIpv6NdTarget that = (ActionSetIpv6NdTarget) other;
72 return ndTarget != null ? ndTarget.equals(that.ndTarget) : that.ndTarget == null;
76 public int hashCode() {
77 int result = super.hashCode();
78 result = 31 * result + (ndTarget != null ? ndTarget.hashCode() : 0);
83 public String toString() {
84 return "ActionSetIpv6NdTarget [source=" + ndTarget + ", getActionKey()=" + getActionKey() + "]";