use of org.batfish.z3.state.NodeDropAcl in project batfish by batfish.
the class DefaultTransitionGeneratorTest method testVisitNodeDropAcl.
@Test
public void testVisitNodeDropAcl() {
SynthesizerInput input = MockSynthesizerInput.builder().setEnabledNodes(ImmutableSet.of(NODE1, NODE2)).build();
Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(NodeDropAcl.State.INSTANCE)));
Set<RuleStatement> expectedCopyNodeDropAclIn = ImmutableSet.of(new BasicRuleStatement(new NodeDropAclIn(NODE1), new NodeDropAcl(NODE1)), new BasicRuleStatement(new NodeDropAclIn(NODE2), new NodeDropAcl(NODE2)));
Set<RuleStatement> expectedCopyNodeDropAclOut = ImmutableSet.of(new BasicRuleStatement(new NodeDropAclOut(NODE1), new NodeDropAcl(NODE1)), new BasicRuleStatement(new NodeDropAclOut(NODE2), new NodeDropAcl(NODE2)));
assertThat(rules, equalTo(Sets.union(expectedCopyNodeDropAclIn, expectedCopyNodeDropAclOut)));
}
use of org.batfish.z3.state.NodeDropAcl in project batfish by batfish.
the class DefaultTransitionGeneratorTest method testVisitNodeDrop.
@Test
public void testVisitNodeDrop() {
SynthesizerInput input = MockSynthesizerInput.builder().setEnabledNodes(ImmutableSet.of(NODE1, NODE2)).build();
Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(NodeDrop.State.INSTANCE)));
// CopyNodeDropAcl
assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropAcl(NODE1), new NodeDrop(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropAcl(NODE2), new NodeDrop(NODE2))));
// CopyNodeDropNoRoute
assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNoRoute(NODE1), new NodeDrop(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNoRoute(NODE2), new NodeDrop(NODE2))));
// CopyNodeDropNullRoute
assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNullRoute(NODE1), new NodeDrop(NODE1))));
assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNullRoute(NODE2), new NodeDrop(NODE2))));
}
use of org.batfish.z3.state.NodeDropAcl in project batfish by batfish.
the class DefaultTransitionGenerator method visitDropAcl.
@Override
public void visitDropAcl(DropAcl.State dropAcl) {
// CopyDropAclIn
_rules.add(new BasicRuleStatement(DropAclIn.INSTANCE, DropAcl.INSTANCE));
// CopyDropAclOut
_rules.add(new BasicRuleStatement(DropAclOut.INSTANCE, DropAcl.INSTANCE));
// ProjectNodeDropAcl (unused for now)
// _rules.add(
// new RuleStatement(
// new OrExpr(
// _input
// .getEnabledNodes()
// .keySet()
// .stream()
// .map(NodeDropAcl::new)
// .collect(ImmutableList.toImmutableList())),
// DropAcl.INSTANCE));
}
use of org.batfish.z3.state.NodeDropAcl in project batfish by batfish.
the class DefaultTransitionGenerator method visitNodeDropAcl.
@Override
public void visitNodeDropAcl(NodeDropAcl.State nodeDropAcl) {
// CopyNodeDropAclIn
_input.getEnabledNodes().stream().map(hostname -> new BasicRuleStatement(new NodeDropAclIn(hostname), new NodeDropAcl(hostname))).forEach(_rules::add);
// CopyNodeDropAclOut
_input.getEnabledNodes().stream().map(hostname -> new BasicRuleStatement(new NodeDropAclOut(hostname), new NodeDropAcl(hostname))).forEach(_rules::add);
}
use of org.batfish.z3.state.NodeDropAcl in project batfish by batfish.
the class DefaultTransitionGenerator method visitNodeDrop.
@Override
public void visitNodeDrop(NodeDrop.State nodeDrop) {
// CopyNodeDropAcl
_input.getEnabledNodes().stream().map(hostname -> new BasicRuleStatement(new NodeDropAcl(hostname), new NodeDrop(hostname))).forEach(_rules::add);
// CopyNodeDropNoRoute
_input.getEnabledNodes().stream().map(hostname -> new BasicRuleStatement(new NodeDropNoRoute(hostname), new NodeDrop(hostname))).forEach(_rules::add);
// CopyNodeDropNullRoute
_input.getEnabledNodes().stream().map(hostname -> new BasicRuleStatement(new NodeDropNullRoute(hostname), new NodeDrop(hostname))).forEach(_rules::add);
}
Aggregations