2 * Copyright (c) 2017 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.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfMetadataCaseBuilder;
16 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;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoadBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.DstBuilder;
21 * NX load metadata action.
23 public class ActionNxLoadMetadata extends ActionInfo {
25 private final BigInteger value;
26 private final Integer startBit;
27 private final Integer endBit;
29 public ActionNxLoadMetadata(BigInteger value, Integer startBit, Integer endBit) {
30 this(0, value, startBit, endBit);
33 public ActionNxLoadMetadata(int actionKey, BigInteger value, Integer startBit, Integer endBit) {
36 this.startBit = startBit;
41 public Action buildAction() {
42 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 DstOfMetadataCaseBuilder().setOfMetadata(true).build())
58 .setKey(new ActionKey(newActionKey))
62 public BigInteger getValue() {
66 public Integer getStartBit() {
70 public Integer getEndBit() {
75 public int hashCode() {
77 int result = super.hashCode();
78 result = prime * result + (endBit == null ? 0 : endBit.hashCode());
79 result = prime * result + (startBit == null ? 0 : startBit.hashCode());
80 result = prime * result + (value == null ? 0 : value.hashCode());
85 public boolean equals(Object obj) {
89 if (!super.equals(obj)) {
92 if (getClass() != obj.getClass()) {
95 ActionNxLoadMetadata other = (ActionNxLoadMetadata) obj;
97 if (other.endBit != null) {
100 } else if (!endBit.equals(other.endBit)) {
103 if (startBit == null) {
104 if (other.startBit != null) {
107 } else if (!startBit.equals(other.startBit)) {
111 if (other.value != null) {
114 } else if (!value.equals(other.value)) {
121 public String toString() {
122 return "ActionNxLoadMetadata [value=" + value + ", startBit=" + startBit + ", endBit=" + endBit
123 + ", getValue()=" + getValue() + ", getStartBit()=" + getStartBit() + ", getEndBit()=" + getEndBit()