Search in sources :

Example 11 with FwFrom

use of org.batfish.representation.juniper.FwFrom in project batfish by batfish.

the class ConfigurationBuilder method exitFftf_packet_length.

@Override
public void exitFftf_packet_length(Fftf_packet_lengthContext ctx) {
    List<SubRange> range = toRange(ctx.range());
    FwFrom from = new FwFromPacketLength(range, false);
    _currentFwTerm.getFroms().add(from);
}
Also used : FwFromPacketLength(org.batfish.representation.juniper.FwFromPacketLength) FwFrom(org.batfish.representation.juniper.FwFrom) SubRange(org.batfish.datamodel.SubRange)

Example 12 with FwFrom

use of org.batfish.representation.juniper.FwFrom 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 13 with FwFrom

use of org.batfish.representation.juniper.FwFrom 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 14 with FwFrom

use of org.batfish.representation.juniper.FwFrom 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 15 with FwFrom

use of org.batfish.representation.juniper.FwFrom in project batfish by batfish.

the class ConfigurationBuilder method exitFftf_destination_prefix_list.

@Override
public void exitFftf_destination_prefix_list(Fftf_destination_prefix_listContext ctx) {
    String name = ctx.name.getText();
    // temporary
    if (_currentFilter.getFamily() != Family.INET) {
        _configuration.getIgnoredPrefixLists().add(name);
    }
    FwFrom from;
    if (ctx.EXCEPT() != null) {
        from = new FwFromDestinationPrefixListExcept(name);
    } else {
        from = new FwFromDestinationPrefixList(name);
    }
    _currentFwTerm.getFroms().add(from);
}
Also used : FwFrom(org.batfish.representation.juniper.FwFrom) FwFromDestinationPrefixList(org.batfish.representation.juniper.FwFromDestinationPrefixList) FwFromDestinationPrefixListExcept(org.batfish.representation.juniper.FwFromDestinationPrefixListExcept)

Aggregations

FwFrom (org.batfish.representation.juniper.FwFrom)19 SubRange (org.batfish.datamodel.SubRange)11 FwFromFragmentOffset (org.batfish.representation.juniper.FwFromFragmentOffset)4 TcpFlags (org.batfish.datamodel.TcpFlags)3 SubrangeContext (org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext)3 FwFromTcpFlags (org.batfish.representation.juniper.FwFromTcpFlags)3 ArrayList (java.util.ArrayList)2 BatfishException (org.batfish.common.BatfishException)2 Ip (org.batfish.datamodel.Ip)2 Prefix (org.batfish.datamodel.Prefix)2 FwFromPacketLength (org.batfish.representation.juniper.FwFromPacketLength)2 FwThenNextIp (org.batfish.representation.juniper.FwThenNextIp)2 PsThenNextHopIp (org.batfish.representation.juniper.PsThenNextHopIp)2 IpProtocol (org.batfish.datamodel.IpProtocol)1 FwFromDestinationAddress (org.batfish.representation.juniper.FwFromDestinationAddress)1 FwFromDestinationAddressExcept (org.batfish.representation.juniper.FwFromDestinationAddressExcept)1 FwFromDestinationPort (org.batfish.representation.juniper.FwFromDestinationPort)1 FwFromDestinationPrefixList (org.batfish.representation.juniper.FwFromDestinationPrefixList)1 FwFromDestinationPrefixListExcept (org.batfish.representation.juniper.FwFromDestinationPrefixListExcept)1 FwFromIcmpCode (org.batfish.representation.juniper.FwFromIcmpCode)1