/** * 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)))); }
SpecifiersReachabilityQuestion question = SpecifiersReachabilityQuestion.builder() .setPathConstraints( PathConstraintsInput.builder() .setStartLocation(".*")
SpecifiersReachabilityQuestion question = SpecifiersReachabilityQuestion.builder() .setPathConstraints( PathConstraintsInput.builder() .setStartLocation(String.format("%s[%s]", NODE1, LOOPBACK))
SpecifiersReachabilityQuestion question = SpecifiersReachabilityQuestion.builder() .setPathConstraints( PathConstraintsInput.builder() .setStartLocation(String.format("%s[%s]", ".*", LOOPBACK))
@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"))); }