Search in sources :

Example 1 with Buffered

use of org.batfish.datamodel.vendor_family.cisco.Buffered in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitLogging_buffered.

@Override
public void exitLogging_buffered(Logging_bufferedContext ctx) {
    if (_no) {
        return;
    }
    Integer size = null;
    Integer severityNum = null;
    String severity = null;
    if (ctx.size != null) {
        // something was parsed as buffer size but it could be logging severity
        // as well
        // it is buffer size if the value is greater than min buffer size
        // otherwise, it is logging severity
        int sizeRawNum = toInteger(ctx.size);
        if (sizeRawNum > Logging.MAX_LOGGING_SEVERITY) {
            size = sizeRawNum;
        } else {
            if (ctx.logging_severity() != null) {
                // if we have explicity severity as well; we've messed up
                throw new BatfishException("Ambiguous parsing of logging buffered");
            }
            severityNum = sizeRawNum;
            severity = toLoggingSeverity(severityNum);
        }
    } else if (ctx.logging_severity() != null) {
        severityNum = toLoggingSeverityNum(ctx.logging_severity());
        severity = toLoggingSeverity(ctx.logging_severity());
    }
    Logging logging = _configuration.getCf().getLogging();
    Buffered buffered = logging.getBuffered();
    if (buffered == null) {
        buffered = new Buffered();
        logging.setBuffered(buffered);
    }
    buffered.setSeverity(severity);
    buffered.setSeverityNum(severityNum);
    buffered.setSize(size);
}
Also used : Logging(org.batfish.datamodel.vendor_family.cisco.Logging) BatfishException(org.batfish.common.BatfishException) RedFlagBatfishException(org.batfish.common.RedFlagBatfishException) Buffered(org.batfish.datamodel.vendor_family.cisco.Buffered)

Aggregations

BatfishException (org.batfish.common.BatfishException)1 RedFlagBatfishException (org.batfish.common.RedFlagBatfishException)1 Buffered (org.batfish.datamodel.vendor_family.cisco.Buffered)1 Logging (org.batfish.datamodel.vendor_family.cisco.Logging)1