/*
- * Copyright © 2016 Red Hat, Inc. and others.
+ * Copyright © 2016, 2017 Red Hat, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
-
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.NxConntrackBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.nx.conntrack.CtActions;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.nx.conntrack.CtActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionCtMarkCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionNatCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMarkBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNatBuilder;
/**
* NX conntrack action.
*/
public class ActionNxConntrack extends ActionInfo {
- private static final long serialVersionUID = 1L;
private final int flags;
private final long zoneSrc;
return recircTable;
}
+ public List<NxCtAction> getCtActions() {
+ return ctActions;
+ }
+
@Override
public boolean equals(Object other) {
if (this == other) {
return result;
}
+ @Override
+ public String toString() {
+ return "ActionNxConntrack [flags=" + flags + ", zoneSrc=" + zoneSrc + ", conntrackZone=" + conntrackZone
+ + ", recircTable=" + recircTable + ", ctActions=" + ctActions + ", getActionKey()=" + getActionKey()
+ + "]";
+ }
+
public interface NxCtAction {
CtActions buildCtActions();
}
-
public static class NxNat implements NxCtAction {
+ private final int actionKey;
private final int flags;
private final int rangePresent;
private final IpAddress ipAddressMin;
private final int portMin;
private final int portMax;
- public NxNat(int actionKey, int flags, int natType, IpAddress ipAddressMin,
+ public NxNat(int actionKey, int flags, int rangePresent, IpAddress ipAddressMin,
IpAddress ipAddressMax,int portMin, int portMax) {
+ this.actionKey = actionKey;
this.flags = flags;
- this.rangePresent = natType;
+ this.rangePresent = rangePresent;
this.ipAddressMin = ipAddressMin;
this.ipAddressMax = ipAddressMax;
this.portMin = portMin;
this.portMax = portMax;
}
+ public int getActionKey() {
+ return actionKey;
+ }
+
+ public int getFlags() {
+ return flags;
+ }
+
+ public int getRangePresent() {
+ return rangePresent;
+ }
+
+ public IpAddress getIpAddressMin() {
+ return ipAddressMin;
+ }
+
+ public IpAddress getIpAddressMax() {
+ return ipAddressMax;
+ }
+
+ public int getPortMin() {
+ return portMin;
+ }
+
+ public int getPortMax() {
+ return portMax;
+ }
+
@Override
public CtActions buildCtActions() {
NxActionNatBuilder nxActionNatBuilder = new NxActionNatBuilder()
result = 31 * result + portMax;
return result;
}
+
+ @Override
+ public String toString() {
+ return "NxNat [flags=" + flags + ", rangePresent=" + rangePresent + ", ipAddressMin=" + ipAddressMin
+ + ", ipAddressMax=" + ipAddressMax + ", portMin=" + portMin + ", portMax=" + portMax + "]";
+ }
+ }
+
+ public static class NxCtMark implements NxCtAction {
+ private final long ctMark;
+
+ public NxCtMark(long ctMark) {
+ this.ctMark = ctMark;
+ }
+
+ public long getCtMark() {
+ return ctMark;
+ }
+
+ @Override
+ public CtActions buildCtActions() {
+ NxActionCtMarkBuilder nxActionCtMarkBuilder = new NxActionCtMarkBuilder()
+ .setCtMark(ctMark);
+
+ CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
+ NxActionCtMarkCaseBuilder caseBuilder = new NxActionCtMarkCaseBuilder();
+ caseBuilder.setNxActionCtMark(nxActionCtMarkBuilder.build());
+ ctActionsBuilder.setOfpactActions(caseBuilder.build());
+ return ctActionsBuilder.build();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null || getClass() != other.getClass()) {
+ return false;
+ }
+
+ NxCtMark that = (NxCtMark) other;
+
+ return ctMark == that.ctMark;
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * (int) (ctMark ^ ctMark >>> 32);
+ }
}
}