Search in sources :

Example 16 with FwFrom

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

the class ConfigurationBuilder method exitFftf_source_address.

@Override
public void exitFftf_source_address(Fftf_source_addressContext ctx) {
    if (ctx.IP_ADDRESS() != null || ctx.IP_PREFIX() != null) {
        Prefix prefix;
        if (ctx.IP_PREFIX() != null) {
            prefix = Prefix.parse(ctx.IP_PREFIX().getText());
        } else {
            prefix = new Prefix(new Ip(ctx.IP_ADDRESS().getText()), Prefix.MAX_PREFIX_LENGTH);
        }
        FwFrom from;
        if (ctx.EXCEPT() != null) {
            from = new FwFromSourceAddressExcept(prefix);
        } else {
            from = new FwFromSourceAddress(prefix);
        }
        _currentFwTerm.getFroms().add(from);
    }
}
Also used : FwFromSourceAddressExcept(org.batfish.representation.juniper.FwFromSourceAddressExcept) PsThenNextHopIp(org.batfish.representation.juniper.PsThenNextHopIp) FwThenNextIp(org.batfish.representation.juniper.FwThenNextIp) Ip(org.batfish.datamodel.Ip) FwFromSourceAddress(org.batfish.representation.juniper.FwFromSourceAddress) FwFrom(org.batfish.representation.juniper.FwFrom) Prefix(org.batfish.datamodel.Prefix)

Example 17 with FwFrom

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

the class ConfigurationBuilder method exitFftf_fragment_offset_except.

@Override
public void exitFftf_fragment_offset_except(Fftf_fragment_offset_exceptContext ctx) {
    SubRange subRange = toSubRange(ctx.subrange());
    FwFrom from = new FwFromFragmentOffset(subRange, true);
    _currentFwTerm.getFroms().add(from);
}
Also used : FwFromFragmentOffset(org.batfish.representation.juniper.FwFromFragmentOffset) FwFrom(org.batfish.representation.juniper.FwFrom) SubRange(org.batfish.datamodel.SubRange)

Example 18 with FwFrom

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

the class ConfigurationBuilder method exitFftf_tcp_flags.

@Override
public void exitFftf_tcp_flags(Fftf_tcp_flagsContext ctx) {
    List<TcpFlags> tcpFlags = toTcpFlags(ctx.tcp_flags());
    FwFrom from = new FwFromTcpFlags(tcpFlags);
    _currentFwTerm.getFroms().add(from);
}
Also used : TcpFlags(org.batfish.datamodel.TcpFlags) FwFromTcpFlags(org.batfish.representation.juniper.FwFromTcpFlags) FwFrom(org.batfish.representation.juniper.FwFrom) FwFromTcpFlags(org.batfish.representation.juniper.FwFromTcpFlags)

Example 19 with FwFrom

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

the class ConfigurationBuilder method exitFftf_source_prefix_list.

@Override
public void exitFftf_source_prefix_list(Fftf_source_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 FwFromSourcePrefixListExcept(name);
    } else {
        from = new FwFromSourcePrefixList(name);
    }
    _currentFwTerm.getFroms().add(from);
}
Also used : FwFrom(org.batfish.representation.juniper.FwFrom) FwFromSourcePrefixListExcept(org.batfish.representation.juniper.FwFromSourcePrefixListExcept) FwFromSourcePrefixList(org.batfish.representation.juniper.FwFromSourcePrefixList)

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