@Test public void testGuardAndTransformSameField() { Prefix guardPrefix = Prefix.parse("1.0.0.0/8"); Prefix shiftIntoPrefix = Prefix.parse("5.5.0.0/16"); Transformation transformation = when(matchDst(guardPrefix)).apply(shiftDestinationIp(shiftIntoPrefix)).build(); Transition transition = _toTransition.toTransition(transformation); BDD guardBdd = _dstIpSpaceToBdd.toBDD(guardPrefix); BDD expectedOut = guardBdd.not(); BDD actualOut = transition.transitForward(_one); assertThat(actualOut, equalTo(expectedOut)); BDD in = _dstIpSpaceToBdd.toBDD(Prefix.parse("1.2.3.0/24")); expectedOut = _dstIpSpaceToBdd.toBDD(Prefix.parse("5.5.3.0/24")); actualOut = transition.transitForward(in); assertThat(actualOut, equalTo(expectedOut)); in = _dstIpSpaceToBdd.toBDD(Prefix.parse("2.2.3.0/24")); expectedOut = in; actualOut = transition.transitForward(in); assertThat(actualOut, equalTo(expectedOut)); BDD expectedIn = _one; BDD actualIn = transition.transitBackward(_one); assertThat(actualIn, equalTo(expectedIn)); BDD out = _dstIpSpaceToBdd.toBDD(Prefix.parse("5.5.3.0/24")); expectedIn = out.or( _dstIpSpaceToBdd.toBDD( IpWildcard.ipWithWildcardMask(Ip.parse("1.0.3.0"), Ip.parse("0.255.0.255")))); actualIn = transition.transitBackward(out); assertThat(actualIn, equalTo(expectedIn)); }
public Transition toTransition(@Nullable Transformation transformation) { return transformation == null ? IDENTITY : _cache.computeIfAbsent(transformation, this::computeTransition); }
TransformationToTransition { public Transition toTransition(@Nullable Transformation transformation) { return transformation == null ? IDENTITY : _cache.computeIfAbsent(transformation, this::computeTransition); } }
TransformationToTransition { public Transition toTransition(@Nullable Transformation transformation) { return transformation == null ? IDENTITY : _cache.computeIfAbsent(transformation, this::computeTransition); } TransformationToTransition(BDDPacket bddPacket, IpAccessListToBdd ipAccessListToBdd); }
TransformationToTransition { public Transition toTransition(@Nullable Transformation transformation) { return transformation == null ? IDENTITY : _cache.computeIfAbsent(transformation, this::computeTransition); } TransformationToTransition(BDDPacket bddPacket, IpAccessListToBdd ipAccessListToBdd); Transition toTransition(@Nullable Transformation transformation); Transition toReturnFlowTransition(@Nullable Transformation transformation); }
TransformationToTransition { public Transition toTransition(@Nullable Transformation transformation) { return transformation == null ? IDENTITY : _cache.computeIfAbsent(transformation, this::computeTransition); } TransformationToTransition(BDDPacket bddPacket, IpAccessListToBdd ipAccessListToBdd); Transition toTransition(@Nullable Transformation transformation); Transition toReturnFlowTransition(@Nullable Transformation transformation);  }