Tabnine Logo
CanonicalAcl.getSanitizedAcl
Code IndexAdd Tabnine to your IDE (free)

How to use
getSanitizedAcl
method
in
org.batfish.datamodel.acl.CanonicalAcl

Best Java code snippets using org.batfish.datamodel.acl.CanonicalAcl.getSanitizedAcl (Showing top 12 results out of 315)

origin: batfish/batfish

    bddPacket, sourceMgr, aclSpec.acl.getDependencies(), ImmutableMap.of());
IpAccessList ipAcl = aclSpec.acl.getSanitizedAcl();
List<IpAccessListLine> lines = ipAcl.getLines();
origin: batfish/batfish

@Test
public void testUndefinedReference() {
 _aclb
   .setLines(
     ImmutableList.of(
       IpAccessListLine.accepting().setMatchCondition(new PermittedByAcl("???")).build()))
   .build();
 List<AclSpecs> aclSpecs = getAclSpecs(ImmutableSet.of("c1"));
 // The sanitized version of the acl should have one unmatchable line
 assertThat(aclSpecs, hasSize(1));
 CanonicalAcl acl = aclSpecs.get(0).acl;
 assertThat(acl.getSanitizedAcl().getLines(), equalTo(ImmutableList.of(UNMATCHABLE)));
 assertThat(acl.hasUndefinedRef(0), equalTo(true));
}
origin: batfish/batfish

@Test
public void testWithUndefinedSrcInterfaceReference() {
 _aclb
   .setLines(
     ImmutableList.of(
       IpAccessListLine.accepting()
         .setMatchCondition(new MatchSrcInterface(ImmutableList.of("???")))
         .build()))
   .build();
 List<AclSpecs> aclSpecs = getAclSpecs(ImmutableSet.of("c1"));
 // The sanitized version of the acl should have one unmatchable line
 assertThat(aclSpecs, hasSize(1));
 AclSpecs spec = aclSpecs.get(0);
 assertThat(spec.acl.getSanitizedAcl().getLines(), equalTo(ImmutableList.of(UNMATCHABLE)));
}
origin: batfish/batfish

@Test
public void testWithUndefinedIpSpaceReference() {
 _aclb
   .setLines(
     ImmutableList.of(
       IpAccessListLine.accepting()
         .setMatchCondition(
           new MatchHeaderSpace(
             HeaderSpace.builder().setSrcIps(new IpSpaceReference("???")).build()))
         .build()))
   .build();
 List<AclSpecs> aclSpecs = getAclSpecs(ImmutableSet.of("c1"));
 // The sanitized version of the acl should have one unmatchable line
 assertThat(aclSpecs, hasSize(1));
 AclSpecs spec = aclSpecs.get(0);
 assertThat(spec.acl.getSanitizedAcl().getLines(), equalTo(ImmutableList.of(UNMATCHABLE)));
}
origin: batfish/batfish

@Test
public void testWithIpSpaceReference() {
 _aclb
   .setLines(
     ImmutableList.of(
       IpAccessListLine.rejecting()
         .setMatchCondition(
           new MatchHeaderSpace(
             HeaderSpace.builder()
               .setSrcIps(new IpSpaceReference("ipSpace"))
               .build()))
         .build()))
   .build();
 List<AclSpecs> aclSpecs = getAclSpecs(ImmutableSet.of("c1"));
 // The sanitized version of the acl should directly reject 1.2.3.4
 assertThat(aclSpecs, hasSize(1));
 AclSpecs spec = aclSpecs.get(0);
 assertThat(
   spec.acl.getSanitizedAcl().getLines(),
   equalTo(
     ImmutableList.of(
       rejectingHeaderSpace(
         HeaderSpace.builder().setSrcIps(Ip.parse("1.2.3.4").toIpSpace()).build()))));
}
origin: batfish/batfish

@Test
public void testWithUndefinedIpSpaceReferenceChain() {
 // Make sure it correctly interprets a chain of IpSpaceReferences ending with an undefined ref
 _c1.setIpSpaces(
   ImmutableSortedMap.of(
     "ipSpace1",
     new IpSpaceReference("ipSpace2"),
     "ipSpace2",
     new IpSpaceReference("ipSpace3")));
 _aclb
   .setLines(
     ImmutableList.of(
       IpAccessListLine.accepting()
         .setMatchCondition(
           new MatchHeaderSpace(
             HeaderSpace.builder()
               .setSrcIps(new IpSpaceReference("ipSpace1"))
               .build()))
         .build()))
   .build();
 List<AclSpecs> aclSpecs = getAclSpecs(ImmutableSet.of("c1"));
 // The sanitized version of the acl should have one unmatchable line
 assertThat(aclSpecs, hasSize(1));
 AclSpecs spec = aclSpecs.get(0);
 assertThat(spec.acl.getSanitizedAcl().getLines(), equalTo(ImmutableList.of(UNMATCHABLE)));
}
origin: batfish/batfish

@Test
public void testWithAclIpSpaceWithCircularRef() {
 // Named IP spaces includes AclIpSpace "aclIpSpace".
 // "aclIpSpace" contains an IpSpaceReference to itself. Rip
 _c1.setIpSpaces(
   ImmutableSortedMap.of(
     "aclIpSpace",
     AclIpSpace.of(AclIpSpaceLine.permit(new IpSpaceReference("aclIpSpace")))));
 _aclb
   .setLines(
     ImmutableList.of(
       IpAccessListLine.accepting()
         .setMatchCondition(
           new MatchHeaderSpace(
             HeaderSpace.builder()
               .setSrcIps(new IpSpaceReference("aclIpSpace"))
               .build()))
         .build()))
   .build();
 List<AclSpecs> aclSpecs = getAclSpecs(ImmutableSet.of("c1"));
 // The sanitized version of the acl should have one unmatchable line
 assertThat(aclSpecs, hasSize(1));
 AclSpecs spec = aclSpecs.get(0);
 assertThat(spec.acl.getSanitizedAcl().getLines(), equalTo(ImmutableList.of(UNMATCHABLE)));
}
origin: batfish/batfish

@Test
public void testWithCircularIpSpaceReferenceChain() {
 // Make sure it identifies an undefined reference for a circular chain of IpSpaceReferences
 _c1.setIpSpaces(
   ImmutableSortedMap.of(
     "ipSpace1",
     new IpSpaceReference("ipSpace2"),
     "ipSpace2",
     new IpSpaceReference("ipSpace3"),
     "ipSpace3",
     new IpSpaceReference("ipSpace1")));
 _aclb
   .setLines(
     ImmutableList.of(
       IpAccessListLine.accepting()
         .setMatchCondition(
           new MatchHeaderSpace(
             HeaderSpace.builder()
               .setSrcIps(new IpSpaceReference("ipSpace1"))
               .build()))
         .build()))
   .build();
 List<AclSpecs> aclSpecs = getAclSpecs(ImmutableSet.of("c1"));
 // The sanitized version of the acl should have one unmatchable line
 assertThat(aclSpecs, hasSize(1));
 AclSpecs spec = aclSpecs.get(0);
 assertThat(spec.acl.getSanitizedAcl().getLines(), equalTo(ImmutableList.of(UNMATCHABLE)));
}
origin: batfish/batfish

   spec.acl.getSanitizedAcl().getLines(),
   equalTo(
     ImmutableList.of(
} else {
 assertThat(spec.acl.getSanitizedAcl().getLines(), equalTo(ImmutableList.of(UNMATCHABLE)));
 assertThat(spec.acl.inCycle(0), equalTo(true));
origin: batfish/batfish

@Test
public void testWithAclIpSpaceWithGoodRefs() {
 // ACL contains an AclIpSpace that references the same valid named IpSpace twice
 _aclb
   .setLines(
     ImmutableList.of(
       acceptingHeaderSpace(
         HeaderSpace.builder()
           .setSrcIps(
             AclIpSpace.of(
               AclIpSpaceLine.permit(new IpSpaceReference("ipSpace")),
               AclIpSpaceLine.permit(new IpSpaceReference("ipSpace"))))
           .build())))
   .build();
 List<AclSpecs> aclSpecs = getAclSpecs(ImmutableSet.of("c1"));
 // The sanitized version of the acl should have correctly dereferenced "ipSpace"
 assertThat(aclSpecs, hasSize(1));
 AclSpecs spec = aclSpecs.get(0);
 assertThat(
   spec.acl.getSanitizedAcl().getLines(),
   equalTo(
     ImmutableList.of(
       acceptingHeaderSpace(
         HeaderSpace.builder()
           .setSrcIps(
             AclIpSpace.of(
               AclIpSpaceLine.permit(Ip.parse("1.2.3.4").toIpSpace()),
               AclIpSpaceLine.permit(Ip.parse("1.2.3.4").toIpSpace())))
           .build()))));
}
origin: batfish/batfish

AclSpecs spec = aclSpecs.get(0);
assertThat(
  spec.acl.getSanitizedAcl().getLines(),
  equalTo(
    ImmutableList.of(
origin: batfish/batfish

    .map(spec -> spec.acl.getSanitizedAcl().getLines().get(0).getMatchCondition())
    .collect(Collectors.toSet());
assertThat(
org.batfish.datamodel.aclCanonicalAclgetSanitizedAcl

Popular methods of CanonicalAcl

  • <init>
  • getDependencies
  • getInterfaces
  • hasUndefinedRef
  • inCycle
  • equals
  • getAclName
  • getOriginalAcl
  • hashCode

Popular in Java

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • getResourceAsStream (ClassLoader)
  • getSupportFragmentManager (FragmentActivity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now