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