use of org.batfish.z3.state.PostInVrf in project batfish by batfish.
the class DefaultTransitionGeneratorTest method testVisitPreOutEdge.
@Test
public void testVisitPreOutEdge() {
SynthesizerInput input = MockSynthesizerInput.builder().setArpTrueEdge(ImmutableMap.of(NODE1, ImmutableMap.of(VRF1, ImmutableMap.of(INTERFACE1, ImmutableMap.of(NODE3, ImmutableMap.of(INTERFACE3, b(1), INTERFACE4, b(2)), NODE4, ImmutableMap.of(INTERFACE3, b(3))), INTERFACE2, ImmutableMap.of(NODE3, ImmutableMap.of(INTERFACE3, b(4)))), VRF2, ImmutableMap.of(INTERFACE3, ImmutableMap.of(NODE3, ImmutableMap.of(INTERFACE3, b(5))))), NODE2, ImmutableMap.of(VRF1, ImmutableMap.of(INTERFACE1, ImmutableMap.of(NODE3, ImmutableMap.of(INTERFACE3, b(6))))))).build();
Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(PreOutEdge.State.INSTANCE)));
// DestinationRouting
assertThat(rules, hasItem(new BasicRuleStatement(b(1), ImmutableSet.of(new PostInVrf(NODE1, VRF1), new PreOut(NODE1)), new PreOutEdge(NODE1, INTERFACE1, NODE3, INTERFACE3))));
assertThat(rules, hasItem(new BasicRuleStatement(b(2), ImmutableSet.of(new PostInVrf(NODE1, VRF1), new PreOut(NODE1)), new PreOutEdge(NODE1, INTERFACE1, NODE3, INTERFACE4))));
assertThat(rules, hasItem(new BasicRuleStatement(b(3), ImmutableSet.of(new PostInVrf(NODE1, VRF1), new PreOut(NODE1)), new PreOutEdge(NODE1, INTERFACE1, NODE4, INTERFACE3))));
assertThat(rules, hasItem(new BasicRuleStatement(b(4), ImmutableSet.of(new PostInVrf(NODE1, VRF1), new PreOut(NODE1)), new PreOutEdge(NODE1, INTERFACE2, NODE3, INTERFACE3))));
assertThat(rules, hasItem(new BasicRuleStatement(b(5), ImmutableSet.of(new PostInVrf(NODE1, VRF2), new PreOut(NODE1)), new PreOutEdge(NODE1, INTERFACE3, NODE3, INTERFACE3))));
assertThat(rules, hasItem(new BasicRuleStatement(b(6), ImmutableSet.of(new PostInVrf(NODE2, VRF1), new PreOut(NODE2)), new PreOutEdge(NODE2, INTERFACE1, NODE3, INTERFACE3))));
}
use of org.batfish.z3.state.PostInVrf in project batfish by batfish.
the class DefaultTransitionGeneratorTest method testVisitPostInVrf.
@Test
public void testVisitPostInVrf() {
SynthesizerInput input = MockSynthesizerInput.builder().setEnabledInterfacesByNodeVrf(ImmutableMap.of(NODE1, ImmutableMap.of(VRF1, ImmutableSet.of(INTERFACE1, INTERFACE2), VRF2, ImmutableSet.of(INTERFACE3, INTERFACE4)), NODE2, ImmutableMap.of(VRF1, ImmutableSet.of(INTERFACE1, INTERFACE2), VRF2, ImmutableSet.of(INTERFACE3, INTERFACE4)))).build();
Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(PostInVrf.State.INSTANCE)));
// CopyOriginateVrf
assertThat(rules, hasItem(new BasicRuleStatement(new OriginateVrf(NODE1, VRF1), new PostInVrf(NODE1, VRF1))));
assertThat(rules, hasItem(new BasicRuleStatement(new OriginateVrf(NODE1, VRF2), new PostInVrf(NODE1, VRF2))));
assertThat(rules, hasItem(new BasicRuleStatement(new OriginateVrf(NODE2, VRF1), new PostInVrf(NODE2, VRF1))));
assertThat(rules, hasItem(new BasicRuleStatement(new OriginateVrf(NODE2, VRF2), new PostInVrf(NODE2, VRF2))));
// PostInInterfaceCorrespondingVrf
assertThat(rules, hasItem(new BasicRuleStatement(new PostInInterface(NODE1, INTERFACE1), new PostInVrf(NODE1, VRF1))));
assertThat(rules, hasItem(new BasicRuleStatement(new PostInInterface(NODE1, INTERFACE2), new PostInVrf(NODE1, VRF1))));
assertThat(rules, hasItem(new BasicRuleStatement(new PostInInterface(NODE1, INTERFACE3), new PostInVrf(NODE1, VRF2))));
assertThat(rules, hasItem(new BasicRuleStatement(new PostInInterface(NODE1, INTERFACE4), new PostInVrf(NODE1, VRF2))));
assertThat(rules, hasItem(new BasicRuleStatement(new PostInInterface(NODE2, INTERFACE1), new PostInVrf(NODE2, VRF1))));
assertThat(rules, hasItem(new BasicRuleStatement(new PostInInterface(NODE2, INTERFACE2), new PostInVrf(NODE2, VRF1))));
assertThat(rules, hasItem(new BasicRuleStatement(new PostInInterface(NODE2, INTERFACE3), new PostInVrf(NODE2, VRF2))));
assertThat(rules, hasItem(new BasicRuleStatement(new PostInInterface(NODE2, INTERFACE4), new PostInVrf(NODE2, VRF2))));
}
use of org.batfish.z3.state.PostInVrf in project batfish by batfish.
the class DefaultTransitionGeneratorTest method testVisitNodeDropNoRoute.
@Test
public void testVisitNodeDropNoRoute() {
SynthesizerInput input = MockSynthesizerInput.builder().setRoutableIps(ImmutableMap.of(NODE1, ImmutableMap.of(VRF1, B1, VRF2, B2), NODE2, ImmutableMap.of(VRF1, B1, VRF2, B2))).build();
Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(NodeDropNoRoute.State.INSTANCE)));
// DestinationRouting
assertThat(rules, hasItem(new BasicRuleStatement(new NotExpr(B1), ImmutableSet.of(new PostInVrf(NODE1, VRF1), new PreOut(NODE1)), new NodeDropNoRoute(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(new NotExpr(B2), ImmutableSet.of(new PostInVrf(NODE1, VRF2), new PreOut(NODE1)), new NodeDropNoRoute(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(new NotExpr(B1), ImmutableSet.of(new PostInVrf(NODE2, VRF1), new PreOut(NODE2)), new NodeDropNoRoute(NODE2))));
assertThat(rules, hasItem(new BasicRuleStatement(new NotExpr(B2), ImmutableSet.of(new PostInVrf(NODE2, VRF2), new PreOut(NODE2)), new NodeDropNoRoute(NODE2))));
}
use of org.batfish.z3.state.PostInVrf in project batfish by batfish.
the class DefaultTransitionGeneratorTest method testVisitNodeDropNullRoute.
@Test
public void testVisitNodeDropNullRoute() {
SynthesizerInput input = MockSynthesizerInput.builder().setNullRoutedIps(ImmutableMap.of(NODE1, ImmutableMap.of(VRF1, B1, VRF2, B2), NODE2, ImmutableMap.of(VRF1, B1, VRF2, B2))).build();
Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(NodeDropNullRoute.State.INSTANCE)));
// DestinationRouting
assertThat(rules, hasItem(new BasicRuleStatement(B1, ImmutableSet.of(new PostInVrf(NODE1, VRF1), new PreOut(NODE1)), new NodeDropNullRoute(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(B2, ImmutableSet.of(new PostInVrf(NODE1, VRF2), new PreOut(NODE1)), new NodeDropNullRoute(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(B1, ImmutableSet.of(new PostInVrf(NODE2, VRF1), new PreOut(NODE2)), new NodeDropNullRoute(NODE2))));
assertThat(rules, hasItem(new BasicRuleStatement(B2, ImmutableSet.of(new PostInVrf(NODE2, VRF2), new PreOut(NODE2)), new NodeDropNullRoute(NODE2))));
}
use of org.batfish.z3.state.PostInVrf in project batfish by batfish.
the class DefaultTransitionGeneratorTest method testVisitNodeNeighborUnreachable.
@Test
public void testVisitNodeNeighborUnreachable() {
SynthesizerInput input = MockSynthesizerInput.builder().setNeighborUnreachable(ImmutableMap.of(NODE1, ImmutableMap.of(VRF1, ImmutableMap.of(INTERFACE1, b(1), INTERFACE2, b(2)), VRF2, ImmutableMap.of(INTERFACE3, b(3))), NODE2, ImmutableMap.of(VRF1, ImmutableMap.of(INTERFACE1, b(4))))).build();
Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(NodeNeighborUnreachable.State.INSTANCE)));
assertThat(rules, hasItem(new BasicRuleStatement(b(1), ImmutableSet.of(new PostInVrf(NODE1, VRF1), new PreOut(NODE1)), new NodeNeighborUnreachable(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(b(2), ImmutableSet.of(new PostInVrf(NODE1, VRF1), new PreOut(NODE1)), new NodeNeighborUnreachable(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(b(3), ImmutableSet.of(new PostInVrf(NODE1, VRF2), new PreOut(NODE1)), new NodeNeighborUnreachable(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(b(4), ImmutableSet.of(new PostInVrf(NODE2, VRF1), new PreOut(NODE2)), new NodeNeighborUnreachable(NODE2))));
}
Aggregations