Search in sources :

Example 1 with SubrangeContext

use of org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext 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 2 with SubrangeContext

use of org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext 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)

Example 3 with SubrangeContext

use of org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext 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);
        }
    }
}
Also used : FwFromSourcePort(org.batfish.representation.juniper.FwFromSourcePort) SubrangeContext(org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext) FwFrom(org.batfish.representation.juniper.FwFrom) SubRange(org.batfish.datamodel.SubRange)

Example 4 with SubrangeContext

use of org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext 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;
}
Also used : ArrayList(java.util.ArrayList) SubrangeContext(org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext) SubRange(org.batfish.datamodel.SubRange)

Aggregations

SubRange (org.batfish.datamodel.SubRange)4 SubrangeContext (org.batfish.grammar.flatjuniper.FlatJuniperParser.SubrangeContext)4 FwFrom (org.batfish.representation.juniper.FwFrom)3 ArrayList (java.util.ArrayList)1 FwFromDestinationPort (org.batfish.representation.juniper.FwFromDestinationPort)1 FwFromPort (org.batfish.representation.juniper.FwFromPort)1 FwFromSourcePort (org.batfish.representation.juniper.FwFromSourcePort)1