Search in sources :

Example 1 with SnmpHost

use of org.batfish.datamodel.SnmpHost in project batfish by batfish.

the class CiscoControlPlaneExtractor method enterSs_host.

@Override
public void enterSs_host(Ss_hostContext ctx) {
    String hostname;
    if (ctx.ip4 != null) {
        hostname = ctx.ip4.getText();
    } else if (ctx.ip6 != null) {
        hostname = ctx.ip6.getText();
    } else if (ctx.host != null) {
        hostname = ctx.host.getText();
    } else {
        throw new BatfishException("Invalid host");
    }
    Map<String, SnmpHost> hosts = _configuration.getSnmpServer().getHosts();
    SnmpHost host = hosts.computeIfAbsent(hostname, SnmpHost::new);
    _currentSnmpHost = host;
}
Also used : BatfishException(org.batfish.common.BatfishException) RedFlagBatfishException(org.batfish.common.RedFlagBatfishException) SnmpHost(org.batfish.datamodel.SnmpHost)

Example 2 with SnmpHost

use of org.batfish.datamodel.SnmpHost in project batfish by batfish.

the class ConfigurationBuilder method exitSnmptg_targets.

@Override
public void exitSnmptg_targets(Snmptg_targetsContext ctx) {
    Ip ip = new Ip(ctx.target.getText());
    String name = ip.toString();
    _currentSnmpServer.getHosts().computeIfAbsent(name, k -> new SnmpHost(ip.toString()));
}
Also used : PsThenNextHopIp(org.batfish.representation.juniper.PsThenNextHopIp) FwThenNextIp(org.batfish.representation.juniper.FwThenNextIp) Ip(org.batfish.datamodel.Ip) SnmpHost(org.batfish.datamodel.SnmpHost)

Aggregations

SnmpHost (org.batfish.datamodel.SnmpHost)2 BatfishException (org.batfish.common.BatfishException)1 RedFlagBatfishException (org.batfish.common.RedFlagBatfishException)1 Ip (org.batfish.datamodel.Ip)1 FwThenNextIp (org.batfish.representation.juniper.FwThenNextIp)1 PsThenNextHopIp (org.batfish.representation.juniper.PsThenNextHopIp)1