Search in sources :

Example 66 with SubRange

use of org.batfish.datamodel.SubRange in project batfish by batfish.

the class Route4FilterLineUpTo method applyTo.

@Override
public void applyTo(RouteFilterList rfl) {
    int prefixLength = _prefix.getPrefixLength();
    org.batfish.datamodel.RouteFilterLine line = new org.batfish.datamodel.RouteFilterLine(LineAction.ACCEPT, _prefix, new SubRange(prefixLength, _maxPrefixLength));
    rfl.addLine(line);
}
Also used : SubRange(org.batfish.datamodel.SubRange)

Example 67 with SubRange

use of org.batfish.datamodel.SubRange in project batfish by batfish.

the class Route6FilterLineExact method applyTo.

@Override
public void applyTo(Route6FilterList rfl) {
    int prefixLength = _prefix6.getPrefixLength();
    org.batfish.datamodel.Route6FilterLine line = new org.batfish.datamodel.Route6FilterLine(LineAction.ACCEPT, _prefix6, new SubRange(prefixLength, prefixLength));
    rfl.addLine(line);
}
Also used : SubRange(org.batfish.datamodel.SubRange)

Example 68 with SubRange

use of org.batfish.datamodel.SubRange in project batfish by batfish.

the class Route6FilterLineOrLonger method applyTo.

@Override
public void applyTo(Route6FilterList rfl) {
    int prefixLength = _prefix6.getPrefixLength();
    org.batfish.datamodel.Route6FilterLine line = new org.batfish.datamodel.Route6FilterLine(LineAction.ACCEPT, _prefix6, new SubRange(prefixLength, Prefix6.MAX_PREFIX_LENGTH));
    rfl.addLine(line);
}
Also used : SubRange(org.batfish.datamodel.SubRange)

Example 69 with SubRange

use of org.batfish.datamodel.SubRange in project batfish by batfish.

the class Route6FilterLineThrough method applyTo.

@Override
public void applyTo(Route6FilterList rfl) {
    int low = _prefix6.getPrefixLength();
    int high = _throughPrefix6.getPrefixLength();
    for (int i = low; i <= high; i++) {
        Ip6 currentNetworkAddress = _throughPrefix6.getAddress().getNetworkAddress(i);
        Prefix6 currentPrefix6 = new Prefix6(currentNetworkAddress, i);
        org.batfish.datamodel.Route6FilterLine line = new org.batfish.datamodel.Route6FilterLine(LineAction.ACCEPT, currentPrefix6, new SubRange(i, i));
        rfl.addLine(line);
    }
}
Also used : SubRange(org.batfish.datamodel.SubRange) Ip6(org.batfish.datamodel.Ip6) Prefix6(org.batfish.datamodel.Prefix6)

Example 70 with SubRange

use of org.batfish.datamodel.SubRange in project batfish by batfish.

the class BoolExprTransformerTest method testVisitRangeMatchExpr.

@Test
public void testVisitRangeMatchExpr() {
    BooleanExpr expr = RangeMatchExpr.fromSubRanges(BasicHeaderField.DSCP, BasicHeaderField.DSCP.getSize(), ImmutableSet.of(new SubRange(1, 3), new SubRange(5, 7)));
    assertThat(toBoolExpr(expr, _input, _nodContext), instanceOf(BoolExpr.class));
}
Also used : BoolExpr(com.microsoft.z3.BoolExpr) BoolExprTransformer.toBoolExpr(org.batfish.z3.expr.visitors.BoolExprTransformer.toBoolExpr) SubRange(org.batfish.datamodel.SubRange) BooleanExpr(org.batfish.z3.expr.BooleanExpr) Test(org.junit.Test)

Aggregations

SubRange (org.batfish.datamodel.SubRange)74 Prefix (org.batfish.datamodel.Prefix)18 IpWildcard (org.batfish.datamodel.IpWildcard)16 ArrayList (java.util.ArrayList)15 IpAccessListLine (org.batfish.datamodel.IpAccessListLine)13 Ip (org.batfish.datamodel.Ip)11 FwFrom (org.batfish.representation.juniper.FwFrom)11 Test (org.junit.Test)11 BatfishException (org.batfish.common.BatfishException)9 LineAction (org.batfish.datamodel.LineAction)9 RouteFilterLine (org.batfish.datamodel.RouteFilterLine)9 LinkedList (java.util.LinkedList)8 IpProtocol (org.batfish.datamodel.IpProtocol)8 RouteFilterList (org.batfish.datamodel.RouteFilterList)8 BoolExpr (com.microsoft.z3.BoolExpr)7 RoutingPolicy (org.batfish.datamodel.routing_policy.RoutingPolicy)7 DestinationNetwork (org.batfish.datamodel.routing_policy.expr.DestinationNetwork)7 MatchPrefixSet (org.batfish.datamodel.routing_policy.expr.MatchPrefixSet)7 IpAccessList (org.batfish.datamodel.IpAccessList)6 PrefixRange (org.batfish.datamodel.PrefixRange)6