2 * Copyright (c) 2016 Red Hat, Inc. 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 java.math.BigInteger;
11 import org.opendaylight.genius.mdsalutil.ActionInfo;
12 import org.opendaylight.genius.mdsalutil.ActionType;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxOfInPortCaseBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoadBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.DstBuilder;
22 * NX load in port action.
24 public class ActionNxLoadInPort extends ActionInfo {
25 private final BigInteger value;
27 public ActionNxLoadInPort(BigInteger value) {
31 public ActionNxLoadInPort(int actionKey, BigInteger value) {
32 super(ActionType.nx_load_in_port, new BigInteger[] {value}, actionKey);
37 public ActionNxLoadInPort(ActionInfo actionInfo) {
38 this(actionInfo.getActionKey(), actionInfo.getBigActionValues()[0]);
42 public Action buildAction() {
43 return buildAction(getActionKey());
46 public Action buildAction(int newActionKey) {
47 return new ActionBuilder()
48 .setAction(new NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder()
49 .setNxRegLoad(new NxRegLoadBuilder()
50 .setDst(new DstBuilder()
51 .setDstChoice(new DstNxOfInPortCaseBuilder().setOfInPort(true).build())
58 .setKey(new ActionKey(newActionKey))
62 public BigInteger getValue() {
67 public boolean equals(Object o) {
68 if (this == o) return true;
69 if (o == null || getClass() != o.getClass()) return false;
70 if (!super.equals(o)) return false;
72 ActionNxLoadInPort that = (ActionNxLoadInPort) o;
74 return value != null ? value.equals(that.value) : that.value == null;
78 public int hashCode() {
79 int result = super.hashCode();
80 result = 31 * result + (value != null ? value.hashCode() : 0);