Search in sources :

Example 1 with Logging

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

the class CiscoControlPlaneExtractor method enterLogging_address.

@Override
public void enterLogging_address(Logging_addressContext ctx) {
    if (_no) {
        return;
    }
    Logging logging = _configuration.getCf().getLogging();
    String hostname = ctx.hostname.getText();
    LoggingHost host = new LoggingHost(hostname);
    logging.getHosts().put(hostname, host);
}
Also used : Logging(org.batfish.datamodel.vendor_family.cisco.Logging) LoggingHost(org.batfish.datamodel.vendor_family.cisco.LoggingHost)

Example 2 with Logging

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

the class CiscoControlPlaneExtractor method exitLogging_trap.

@Override
public void exitLogging_trap(Logging_trapContext ctx) {
    if (_no) {
        return;
    }
    Integer severityNum = null;
    String severity = null;
    if (ctx.logging_severity() != null) {
        severityNum = toLoggingSeverityNum(ctx.logging_severity());
        severity = toLoggingSeverity(ctx.logging_severity());
    }
    Logging logging = _configuration.getCf().getLogging();
    LoggingType trap = logging.getTrap();
    if (trap == null) {
        trap = new LoggingType();
        logging.setTrap(trap);
    }
    trap.setSeverity(severity);
    trap.setSeverityNum(severityNum);
}
Also used : Logging(org.batfish.datamodel.vendor_family.cisco.Logging) LoggingType(org.batfish.datamodel.vendor_family.cisco.LoggingType)

Example 3 with Logging

use of org.batfish.datamodel.vendor_family.cisco.Logging 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)

Example 4 with Logging

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

the class CiscoControlPlaneExtractor method exitLogging_server.

@Override
public void exitLogging_server(Logging_serverContext ctx) {
    if (_no) {
        return;
    }
    Logging logging = _configuration.getCf().getLogging();
    String hostname = ctx.hostname.getText();
    LoggingHost host = new LoggingHost(hostname);
    logging.getHosts().put(hostname, host);
}
Also used : Logging(org.batfish.datamodel.vendor_family.cisco.Logging) LoggingHost(org.batfish.datamodel.vendor_family.cisco.LoggingHost)

Example 5 with Logging

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

the class CiscoControlPlaneExtractor method enterCisco_configuration.

@Override
public void enterCisco_configuration(Cisco_configurationContext ctx) {
    _configuration = new CiscoConfiguration(_unimplementedFeatures);
    _configuration.setVendor(_format);
    _currentVrf = Configuration.DEFAULT_VRF_NAME;
    if (_format == ConfigurationFormat.CISCO_IOS) {
        Logging logging = new Logging();
        logging.setOn(true);
        _configuration.getCf().setLogging(logging);
    }
}
Also used : Logging(org.batfish.datamodel.vendor_family.cisco.Logging) CiscoConfiguration(org.batfish.representation.cisco.CiscoConfiguration)

Aggregations

Logging (org.batfish.datamodel.vendor_family.cisco.Logging)9 LoggingHost (org.batfish.datamodel.vendor_family.cisco.LoggingHost)3 LoggingType (org.batfish.datamodel.vendor_family.cisco.LoggingType)2 BatfishException (org.batfish.common.BatfishException)1 RedFlagBatfishException (org.batfish.common.RedFlagBatfishException)1 Buffered (org.batfish.datamodel.vendor_family.cisco.Buffered)1 CiscoConfiguration (org.batfish.representation.cisco.CiscoConfiguration)1