Search in sources :

Example 6 with FwFrom

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

the class ConfigurationBuilder method exitFftf_protocol.

@Override
public void exitFftf_protocol(Fftf_protocolContext ctx) {
    IpProtocol protocol = toIpProtocol(ctx.ip_protocol());
    FwFrom from = new FwFromProtocol(protocol);
    _currentFwTerm.getFroms().add(from);
}
Also used : IpProtocol(org.batfish.datamodel.IpProtocol) FwFrom(org.batfish.representation.juniper.FwFrom) FwFromProtocol(org.batfish.representation.juniper.FwFromProtocol)

Example 7 with FwFrom

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

the class ConfigurationBuilder method exitFftf_icmp_type.

@Override
public void exitFftf_icmp_type(Fftf_icmp_typeContext ctx) {
    if (_currentFirewallFamily == Family.INET6) {
        // TODO: support icmpv6
        return;
    }
    SubRange icmpTypeRange;
    if (ctx.subrange() != null) {
        icmpTypeRange = toSubRange(ctx.subrange());
    } else if (ctx.icmp_type() != null) {
        int icmpType = toIcmpType(ctx.icmp_type());
        icmpTypeRange = new SubRange(icmpType, icmpType);
    } else {
        throw new BatfishException("Invalid icmp-type");
    }
    FwFrom from = new FwFromIcmpType(icmpTypeRange);
    _currentFwTerm.getFroms().add(from);
}
Also used : BatfishException(org.batfish.common.BatfishException) FwFromIcmpType(org.batfish.representation.juniper.FwFromIcmpType) FwFrom(org.batfish.representation.juniper.FwFrom) SubRange(org.batfish.datamodel.SubRange)

Example 8 with FwFrom

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

the class ConfigurationBuilder method exitFftf_tcp_initial.

@Override
public void exitFftf_tcp_initial(Fftf_tcp_initialContext ctx) {
    List<TcpFlags> tcpFlags = new ArrayList<>();
    TcpFlags alt1 = new TcpFlags();
    alt1.setUseAck(true);
    alt1.setAck(false);
    alt1.setUseSyn(true);
    alt1.setSyn(true);
    tcpFlags.add(alt1);
    FwFrom from = new FwFromTcpFlags(tcpFlags);
    _currentFwTerm.getFroms().add(from);
}
Also used : TcpFlags(org.batfish.datamodel.TcpFlags) FwFromTcpFlags(org.batfish.representation.juniper.FwFromTcpFlags) ArrayList(java.util.ArrayList) FwFrom(org.batfish.representation.juniper.FwFrom) FwFromTcpFlags(org.batfish.representation.juniper.FwFromTcpFlags)

Example 9 with FwFrom

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

the class ConfigurationBuilder method exitFftf_destination_port.

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

Example 10 with FwFrom

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

the class ConfigurationBuilder method exitFftf_port.

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

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