+
+ @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 IpAddress ipAddressMax;
+ private final int portMin;
+ private final int portMax;
+
+ public NxNat(int actionKey, int flags, int rangePresent, IpAddress ipAddressMin,
+ IpAddress ipAddressMax,int portMin, int portMax) {
+ this.actionKey = actionKey;
+ this.flags = flags;
+ 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()
+ .setFlags(flags)
+ .setRangePresent(rangePresent)
+ .setIpAddressMin(ipAddressMin)
+ .setIpAddressMax(ipAddressMax)
+ .setPortMin(portMin)
+ .setPortMax(portMax);
+
+ CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
+ NxActionNatCaseBuilder caseBuilder = new NxActionNatCaseBuilder();
+ caseBuilder.setNxActionNat(nxActionNatBuilder.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;
+ }
+
+ NxNat that = (NxNat) other;
+
+ if (flags != that.flags) {
+ return false;
+ }
+ if (rangePresent != that.rangePresent) {
+ return false;
+ }
+ if (ipAddressMin != null ? !ipAddressMin.equals(that.ipAddressMin) : that.ipAddressMin != null) {
+ return false;
+ }
+ if (ipAddressMax != null ? !ipAddressMax.equals(that.ipAddressMax) : that.ipAddressMax != null) {
+ return false;
+ }
+ if (portMin != that.portMin) {
+ return false;
+ }
+ return portMax == that.portMax;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = flags;
+ result = 31 * result + rangePresent;
+ result = 31 * result + ipAddressMin.hashCode();
+ result = 31 * result + ipAddressMax.hashCode();
+ result = 31 * result + portMin;
+ 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);
+ }
+ }