Search in sources :

Example 1 with FwFromIcmpCode

use of org.batfish.representation.juniper.FwFromIcmpCode 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)

Aggregations

BatfishException (org.batfish.common.BatfishException)1 SubRange (org.batfish.datamodel.SubRange)1 FwFrom (org.batfish.representation.juniper.FwFrom)1 FwFromIcmpCode (org.batfish.representation.juniper.FwFromIcmpCode)1