Codota Logo
CanonicalAcl
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: batfish/batfish

  new CanonicalAcl(
    acl1,
    acl1,
    ImmutableSet.of());
CanonicalAcl canonicalAcl2 =
  new CanonicalAcl(
    acl1,
    acl1,
origin: batfish/batfish

BDDFactory bddFactory = bddPacket.getFactory();
BDDSourceManager sourceMgr =
  BDDSourceManager.forInterfaces(bddPacket, aclSpec.acl.getInterfaces());
IpAccessListToBDD ipAccessListToBDD =
  IpAccessListToBDD.create(
    bddPacket, sourceMgr, aclSpec.acl.getDependencies(), ImmutableMap.of());
IpAccessList ipAcl = aclSpec.acl.getSanitizedAcl();
List<IpAccessListLine> lines = ipAcl.getLines();
origin: batfish/batfish

 @Nonnull SortedSet<Integer> blockingLines) {
if (aclSpecs.acl.inCycle(lineNumber)) {
 return;
IpAccessList acl = aclSpecs.acl.getOriginalAcl();
IpAccessListLine blockedLine = acl.getLines().get(lineNumber);
boolean diffAction =
  canonicalAcl.hasUndefinedRef(lineNumber)
    ? Reason.UNDEFINED_REFERENCE
    : unmatchable ? Reason.INDEPENDENTLY_UNMATCHABLE : Reason.BLOCKING_LINES;
origin: batfish/batfish

 new CanonicalAcl(
   node.getSanitizedAcl(),
   node.getAcl(),
if (aclSpec.getAcl().equals(currentAcl)) {
 aclSpec.addSource(hostname, aclName);
 added = 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

if (spec.acl.getAclName().equals("acl3")) {
   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 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

    .filter(spec -> !spec.acl.getAclName().equals("acl0"))
    .map(spec -> spec.acl.getDependencies().keySet())
    .collect(Collectors.toList());
assertThat(
origin: batfish/batfish

@Test
public void testReferencedAclUsesSrcInterface() {
 // Create ACL that references an ACL that references an interface
 _aclb
   .setLines(
     ImmutableList.of(
       IpAccessListLine.accepting()
         .setMatchCondition(new PermittedByAcl("referencedAcl"))
         .build()))
   .build();
 _aclb
   .setLines(
     ImmutableList.of(
       IpAccessListLine.accepting()
         .setMatchCondition(new MatchSrcInterface(ImmutableList.of("iface")))
         .build()))
   .setName("referencedAcl")
   .build();
 List<AclSpecs> aclSpecs = getAclSpecs(ImmutableSet.of("c1"));
 // There should be two AclSpecs. Both should be aware of the interface "iface"
 assertThat(aclSpecs, hasSize(2));
 for (AclSpecs spec : aclSpecs) {
  assertThat(
    spec.acl.getInterfaces(), equalTo(ImmutableSet.of("iface", "unreferencedInterface")));
 }
}
origin: batfish/batfish

@Override
public boolean equals(Object o) {
 if (o == this) {
  return true;
 } else if (!(o instanceof CanonicalAcl)) {
  return false;
 } else if (hashCode() != o.hashCode()) {
  return false;
 }
 CanonicalAcl otherAcl = (CanonicalAcl) o;
 return _acl.equals(otherAcl._acl)
   && _dependencies.equals(otherAcl._dependencies)
   && _interfaces.equals(otherAcl._interfaces)
   && _sanitizedAcl.equals(otherAcl._sanitizedAcl)
   && _linesWithUndefinedReferences.equals(otherAcl._linesWithUndefinedReferences)
   && _linesInCycles.equals(otherAcl._linesInCycles);
}
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

aclSpecs.get(0).acl.getInterfaces(),
equalTo(ImmutableSet.of("iface1", "iface2", "iface3")));
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

  new CanonicalAcl(
    acl1, acl1, ImmutableMap.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of());
CanonicalAcl canonicalAcl2 =
  new CanonicalAcl(
    acl2, acl2, ImmutableMap.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of());
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

  new CanonicalAcl(
    acl1,
    acl1,
    ImmutableSet.of());
CanonicalAcl canonicalAcl2 =
  new CanonicalAcl(
    acl2,
    acl2,
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

  new CanonicalAcl(
    acl1,
    acl1,
    ImmutableSet.of());
CanonicalAcl canonicalAcl2 =
  new CanonicalAcl(
    acl2,
    acl2,
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

@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()))));
}
org.batfish.datamodel.aclCanonicalAcl

Javadoc

Represents an ACL with all its dependencies for the purpose of detecting identical ACLs.

Most used methods

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

Popular in Java

  • Start an intent from android
  • getSystemService (Context)
  • addToBackStack (FragmentTransaction)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • JOptionPane (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now