Search in sources :

Example 46 with SubRange

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

the class ConfigurationBuilder method exitFftf_source_port.

@Override
public void exitFftf_source_port(Fftf_source_portContext ctx) {
    if (ctx.port() != null) {
        int port = getPortNumber(ctx.port());
        SubRange subrange = new SubRange(port, port);
        FwFrom from = new FwFromSourcePort(subrange);
        _currentFwTerm.getFroms().add(from);
    } else if (ctx.range() != null) {
        for (SubrangeContext subrangeContext : ctx.range().range_list) {
            SubRange subrange = toSubRange(subrangeContext);
            FwFrom from = new FwFromSourcePort(subrange);
            _currentFwTerm.getFroms().add(from);
        }
    }
}
Also used : FwFromSourcePort(org.batfish.representation.juniper.FwFromSourcePort) SubrangeContext(org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext) FwFrom(org.batfish.representation.juniper.FwFrom) SubRange(org.batfish.datamodel.SubRange)

Example 47 with SubRange

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

the class ConfigurationBuilder method exitFftf_first_fragment.

@Override
public void exitFftf_first_fragment(Fftf_first_fragmentContext ctx) {
    SubRange subRange = new SubRange(0, 0);
    FwFrom from = new FwFromFragmentOffset(subRange, false);
    _currentFwTerm.getFroms().add(from);
}
Also used : FwFromFragmentOffset(org.batfish.representation.juniper.FwFromFragmentOffset) FwFrom(org.batfish.representation.juniper.FwFrom) SubRange(org.batfish.datamodel.SubRange)

Example 48 with SubRange

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

the class ConfigurationBuilder method exitFftf_icmp_code.

@Override
public void exitFftf_icmp_code(Fftf_icmp_codeContext ctx) {
    if (_currentFirewallFamily == Family.INET6) {
        // TODO: support icmpv6
        return;
    }
    SubRange icmpCodeRange;
    if (ctx.subrange() != null) {
        icmpCodeRange = toSubRange(ctx.subrange());
    } else if (ctx.icmp_code() != null) {
        int icmpCode = toIcmpCode(ctx.icmp_code());
        icmpCodeRange = new SubRange(icmpCode, icmpCode);
    } else {
        throw new BatfishException("Invalid icmp-code");
    }
    FwFrom from = new FwFromIcmpCode(icmpCodeRange);
    _currentFwTerm.getFroms().add(from);
}
Also used : BatfishException(org.batfish.common.BatfishException) FwFromIcmpCode(org.batfish.representation.juniper.FwFromIcmpCode) FwFrom(org.batfish.representation.juniper.FwFrom) SubRange(org.batfish.datamodel.SubRange)

Example 49 with SubRange

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

the class ConfigurationBuilder method toRange.

private static List<SubRange> toRange(RangeContext ctx) {
    List<SubRange> range = new ArrayList<>();
    for (SubrangeContext sc : ctx.range_list) {
        SubRange sr = toSubRange(sc);
        range.add(sr);
    }
    return range;
}
Also used : ArrayList(java.util.ArrayList) SubrangeContext(org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext) SubRange(org.batfish.datamodel.SubRange)

Example 50 with SubRange

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

the class ConfigurationBuilder method exitAat_destination_port.

@Override
public void exitAat_destination_port(Aat_destination_portContext ctx) {
    SubRange subrange = toSubRange(ctx.subrange());
    _currentApplicationTerm.getLine().getDstPorts().add(subrange);
}
Also used : SubRange(org.batfish.datamodel.SubRange)

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