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);
}
}
}
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);
}
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);
}
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;
}
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);
}
Aggregations