.setPathConstraints( PathConstraintsInput.builder() .setStartLocation(String.format("%s[%s]", ".*", LOOPBACK)) .setTransitLocations(".*") .build()) .build(); AnswerElement answer = new SpecifiersReachabilityAnswerer(question, _batfish).answer();
.setPathConstraints( PathConstraintsInput.builder() .setStartLocation(".*") .setForbiddenLocations(".*") .build()) .build(); AnswerElement answer = new SpecifiersReachabilityAnswerer(question, _batfish).answer();
.setPathConstraints( PathConstraintsInput.builder() .setStartLocation(String.format("%s[%s]", NODE1, LOOPBACK)) .build()) .setActions(new DispositionSpecifier(ImmutableSortedSet.of(FlowDisposition.NO_ROUTE))) .build();
/** * Test that the results we get with the default source IpSpace specifier ({@link * org.batfish.specifier.InferFromLocationIpSpaceSpecifier}) are correct for the network. */ @Test public void testInferSrcIpFromLocation() { SpecifiersReachabilityQuestion question = SpecifiersReachabilityQuestion.builder() .setPathConstraints( PathConstraintsInput.builder() .setStartLocation(String.format("%s[%s]", NODE1, LOOPBACK)) .build()) .build(); AnswerElement answer = new SpecifiersReachabilityAnswerer(question, _batfish).answer(); assertThat(answer, instanceOf(TableAnswerElement.class)); TableAnswerElement tableAnswerElement = (TableAnswerElement) answer; assertThat(tableAnswerElement.getRowsList().size(), equalTo(1)); assertThat( tableAnswerElement, hasRows( hasItem( hasColumn( COL_FLOW, allOf(hasIngressNode(NODE1), hasSrcIp(NODE1_LOOPBACK_IP)), FLOW)))); }
@Test public void testTransitAndForbiddenNodesSpecification() { SpecifiersReachabilityQuestion question = SpecifiersReachabilityQuestion.builder() .setPathConstraints( PathConstraintsInput.builder() .setTransitLocations("foo") .setForbiddenLocations("bar") .build()) .build(); assertThat( question.getReachabilityParameters().getRequiredTransitNodesSpecifier(), equalTo( NodeSpecifierFactory.load(FlexibleNodeSpecifierFactory.NAME) .buildNodeSpecifier("foo"))); assertThat( question.getReachabilityParameters().getForbiddenTransitNodesSpecifier(), equalTo( NodeSpecifierFactory.load(FlexibleNodeSpecifierFactory.NAME) .buildNodeSpecifier("bar"))); }
public static Builder builder() { return new Builder(); }