use of org.batfish.datamodel.Flow in project batfish by batfish.
the class AbstractNodJob method call.
@Override
public final NodJobResult call() {
long startTime = System.currentTimeMillis();
try (Context ctx = new Context()) {
SmtInput smtInput = computeSmtInput(startTime, ctx);
Map<OriginateVrf, Map<String, Long>> originateVrfConstraints = getOriginateVrfConstraints(ctx, smtInput);
Set<Flow> flows = getFlows(originateVrfConstraints);
return new NodJobResult(startTime, _logger.getHistory(), flows);
} catch (Z3Exception e) {
return new NodJobResult(startTime, _logger.getHistory(), new BatfishException("Error running NoD on concatenated data plane", e));
}
}
use of org.batfish.datamodel.Flow in project batfish by batfish.
the class BdpDataPlanePluginTest method testApplySourceNatSingleAclMatch.
@Test
public void testApplySourceNatSingleAclMatch() {
Flow flow = makeFlow();
SourceNat nat = new SourceNat();
nat.setAcl(makeAcl("accept", LineAction.ACCEPT));
nat.setPoolIpFirst(new Ip("4.5.6.7"));
Flow transformed = BdpEngine.applySourceNat(flow, singletonList(nat));
assertThat(transformed.getSrcIp(), equalTo(new Ip("4.5.6.7")));
}
use of org.batfish.datamodel.Flow in project batfish by batfish.
the class BdpDataPlanePluginTest method makeFlow.
private static Flow makeFlow() {
Flow.Builder builder = new Flow.Builder();
builder.setSrcIp(new Ip("1.2.3.4"));
builder.setIngressNode("foo");
builder.setTag("TEST");
return builder.build();
}
use of org.batfish.datamodel.Flow in project batfish by batfish.
the class BdpDataPlanePluginTest method testApplySourceNatLateMatchWins.
@Test
public void testApplySourceNatLateMatchWins() {
Flow flow = makeFlow();
SourceNat nat = new SourceNat();
nat.setAcl(makeAcl("rejectAll", LineAction.REJECT));
nat.setPoolIpFirst(new Ip("4.5.6.7"));
SourceNat secondNat = new SourceNat();
secondNat.setAcl(makeAcl("acceptAnyway", LineAction.ACCEPT));
secondNat.setPoolIpFirst(new Ip("4.5.6.8"));
Flow transformed = BdpEngine.applySourceNat(flow, Lists.newArrayList(nat, secondNat));
assertThat(transformed.getSrcIp(), equalTo(new Ip("4.5.6.8")));
}
use of org.batfish.datamodel.Flow in project batfish by batfish.
the class BdpDataPlanePluginTest method testApplySourceNatInvalidAclThrows.
@Test
public void testApplySourceNatInvalidAclThrows() {
Flow flow = makeFlow();
SourceNat nat = new SourceNat();
nat.setAcl(makeAcl("matchAll", LineAction.ACCEPT));
_thrown.expect(BatfishException.class);
_thrown.expectMessage("missing NAT address or pool");
BdpEngine.applySourceNat(flow, singletonList(nat));
}
Aggregations