@Test public void testMatchAndAssignSameField() { Ip matchIp = Ip.parse("255.255.255.255"); Ip poolIp = Ip.parse("0.0.0.0"); Transformation transformation = when(matchDst(matchIp)).apply(assignDestinationIp(poolIp, poolIp)).build(); Interface i = _ib.setIncomingTransformation(transformation) .setOutgoingTransformation(transformation) .build(); BDDReverseFlowTransformationFactoryImpl factory = new BDDReverseFlowTransformationFactoryImpl(_configs, _transformationToTransitions); BDD matchBdd = srcBdd(matchIp); BDD poolBdd = srcBdd(poolIp); Transition transition = factory.reverseFlowIncomingTransformation(HOSTNAME, i.getName()); assertThat( "pool Ip may or may not have been natted.", transition.transitForward(poolBdd), equalTo(matchBdd.or(poolBdd))); assertThat( "If outside the pool, not matched", transition.transitForward(poolBdd.not()), equalTo(poolBdd.not().and(matchBdd.not()))); }
@Override public @Nonnull Transition reverseFlowIncomingTransformation(String hostname, String iface) { return _reverseFlowIncomingTransformations.computeIfAbsent( NodeInterfacePair.of(hostname, iface), k -> computeReverseFlowTransformation( hostname, _configs.get(hostname).getAllInterfaces().get(iface).getIncomingTransformation())); }
BDDReverseFlowTransformationFactoryImpl implements BDDReverseFlowTransformationFactory { @Override public @Nonnull Transition reverseFlowIncomingTransformation(String hostname, String iface) { return _reverseFlowIncomingTransformations.computeIfAbsent( NodeInterfacePair.of(hostname, iface), k -> computeReverseFlowTransformation( hostname, _configs.get(hostname).getAllInterfaces().get(iface).getIncomingTransformation())); } }
BDDReverseFlowTransformationFactoryImpl implements BDDReverseFlowTransformationFactory { @Override public @Nonnull Transition reverseFlowIncomingTransformation(String hostname, String iface) { return _reverseFlowIncomingTransformations.computeIfAbsent( NodeInterfacePair.of(hostname, iface), k -> computeReverseFlowTransformation( hostname, _configs.get(hostname).getAllInterfaces().get(iface).getIncomingTransformation())); } BDDReverseFlowTransformationFactoryImpl(
      Map<String, Configuration> configs,
      Map<String, TransformationToTransition> transformationToTransitions); }
BDDReverseFlowTransformationFactoryImpl implements BDDReverseFlowTransformationFactory { @Override public @Nonnull Transition reverseFlowIncomingTransformation(String hostname, String iface) { return _reverseFlowIncomingTransformations.computeIfAbsent( NodeInterfacePair.of(hostname, iface), k -> computeReverseFlowTransformation( hostname, _configs.get(hostname).getAllInterfaces().get(iface).getIncomingTransformation())); } BDDReverseFlowTransformationFactoryImpl(
      Map<String, Configuration> configs,
      Map<String, TransformationToTransition> transformationToTransitions); @Override @Nonnull Transition reverseFlowIncomingTransformation(String hostname, String iface); @Override @Nonnull Transition reverseFlowOutgoingTransformation(String hostname, String iface); }
BDDReverseFlowTransformationFactoryImpl implements BDDReverseFlowTransformationFactory { @Override public @Nonnull Transition reverseFlowIncomingTransformation(String hostname, String iface) { return _reverseFlowIncomingTransformations.computeIfAbsent( NodeInterfacePair.of(hostname, iface), k -> computeReverseFlowTransformation( hostname, _configs.get(hostname).getAllInterfaces().get(iface).getIncomingTransformation())); } BDDReverseFlowTransformationFactoryImpl(
      Map<String, Configuration> configs,
      Map<String, TransformationToTransition> transformationToTransitions); @Override @Nonnull Transition reverseFlowIncomingTransformation(String hostname, String iface); @Override @Nonnull Transition reverseFlowOutgoingTransformation(String hostname, String iface);  }