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