@Test public void testToTransformationSteps() { Prefix prefix1 = Prefix.parse("1.1.1.1/24"); NatRuleThenPrefix thenPrefix1 = new NatRuleThenPrefix(prefix1, DESTINATION); List<TransformationStep> steps = thenPrefix1.toTransformationSteps(new Nat(Type.STATIC), null, null, null); assertThat( steps, contains( new ShiftIpAddressIntoSubnet(TransformationType.STATIC_NAT, DESTINATION, prefix1))); thenPrefix1 = new NatRuleThenPrefix(prefix1, SOURCE); steps = thenPrefix1.toTransformationSteps(new Nat(Type.STATIC), null, null, null); assertThat( steps, contains(new ShiftIpAddressIntoSubnet(TransformationType.STATIC_NAT, SOURCE, prefix1))); }
@Override public List<TransformationStep> toTransformationSteps( Nat nat, @Nullable Map<String, AddressBookEntry> addressBookEntryMap, Ip interfaceIp, Warnings warnings) { checkArgument(nat.getType() == STATIC, "Prefix can only be used in static nat"); ImmutableList.Builder<TransformationStep> builder = new Builder<>(); builder.add(new ShiftIpAddressIntoSubnet(TransformationType.STATIC_NAT, _ipField, _prefix)); return builder.build(); }
NatRuleThenPrefix implements NatRuleThen, Serializable { @Override public List<TransformationStep> toTransformationSteps( Nat nat, @Nullable Map<String, AddressBookEntry> addressBookEntryMap, Ip interfaceIp, Warnings warnings) { checkArgument(nat.getType() == STATIC, "Prefix can only be used in static nat"); ImmutableList.Builder<TransformationStep> builder = new Builder<>(); builder.add(new ShiftIpAddressIntoSubnet(TransformationType.STATIC_NAT, _ipField, _prefix)); return builder.build(); } }
NatRuleThenPrefix implements NatRuleThen, Serializable { @Override public List<TransformationStep> toTransformationSteps( Nat nat, @Nullable Map<String, AddressBookEntry> addressBookEntryMap, Ip interfaceIp, Warnings warnings) { checkArgument(nat.getType() == STATIC, "Prefix can only be used in static nat"); ImmutableList.Builder<TransformationStep> builder = new Builder<>(); builder.add(new ShiftIpAddressIntoSubnet(TransformationType.STATIC_NAT, _ipField, _prefix)); return builder.build(); } NatRuleThenPrefix(Prefix prefix, IpField ipField); }
NatRuleThenPrefix implements NatRuleThen, Serializable { @Override public List<TransformationStep> toTransformationSteps( Nat nat, @Nullable Map<String, AddressBookEntry> addressBookEntryMap, Ip interfaceIp, Warnings warnings) { checkArgument(nat.getType() == STATIC, "Prefix can only be used in static nat"); ImmutableList.Builder<TransformationStep> builder = new Builder<>(); builder.add(new ShiftIpAddressIntoSubnet(TransformationType.STATIC_NAT, _ipField, _prefix)); return builder.build(); } NatRuleThenPrefix(Prefix prefix, IpField ipField); Prefix getPrefix(); @Override boolean equals(Object o); @Override int hashCode(); @Override List<TransformationStep> toTransformationSteps(
      Nat nat,
      @Nullable Map<String, AddressBookEntry> addressBookEntryMap,
      Ip interfaceIp,
      Warnings warnings); }
NatRuleThenPrefix implements NatRuleThen, Serializable { @Override public List<TransformationStep> toTransformationSteps( Nat nat, @Nullable Map<String, AddressBookEntry> addressBookEntryMap, Ip interfaceIp, Warnings warnings) { checkArgument(nat.getType() == STATIC, "Prefix can only be used in static nat"); ImmutableList.Builder<TransformationStep> builder = new Builder<>(); builder.add(new ShiftIpAddressIntoSubnet(TransformationType.STATIC_NAT, _ipField, _prefix)); return builder.build(); } NatRuleThenPrefix(Prefix prefix, IpField ipField); Prefix getPrefix(); @Override boolean equals(Object o); @Override int hashCode(); @Override List<TransformationStep> toTransformationSteps(
      Nat nat,
      @Nullable Map<String, AddressBookEntry> addressBookEntryMap,
      Ip interfaceIp,
      Warnings warnings);  }