Search in sources :

Example 1 with OspfProcess

use of org.batfish.representation.cisco.OspfProcess in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitRo_passive_interface.

@Override
public void exitRo_passive_interface(Ro_passive_interfaceContext ctx) {
    boolean passive = ctx.NO() == null;
    String iname = ctx.i.getText();
    OspfProcess proc = _currentOspfProcess;
    if (passive) {
        proc.getPassiveInterfaceList().add(iname);
    } else {
        proc.getActiveInterfaceList().add(iname);
    }
}
Also used : OspfProcess(org.batfish.representation.cisco.OspfProcess)

Example 2 with OspfProcess

use of org.batfish.representation.cisco.OspfProcess in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitRo_default_information.

@Override
public void exitRo_default_information(Ro_default_informationContext ctx) {
    OspfProcess proc = _currentOspfProcess;
    proc.setDefaultInformationOriginate(true);
    boolean always = ctx.ALWAYS().size() > 0;
    proc.setDefaultInformationOriginateAlways(always);
    if (ctx.metric != null) {
        int metric = toInteger(ctx.metric);
        proc.setDefaultInformationMetric(metric);
    }
    if (ctx.metric_type != null) {
        int metricTypeInt = toInteger(ctx.metric_type);
        OspfMetricType metricType = OspfMetricType.fromInteger(metricTypeInt);
        proc.setDefaultInformationMetricType(metricType);
    }
    if (ctx.map != null) {
        int line = ctx.map.getLine();
        proc.setDefaultInformationOriginateMap(ctx.map.getText());
        proc.setDefaultInformationOriginateMapLine(line);
    }
}
Also used : OspfMetricType(org.batfish.datamodel.OspfMetricType) RoutePolicySetOspfMetricType(org.batfish.representation.cisco.RoutePolicySetOspfMetricType) OspfProcess(org.batfish.representation.cisco.OspfProcess)

Example 3 with OspfProcess

use of org.batfish.representation.cisco.OspfProcess in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitRo_area_nssa.

@Override
public void exitRo_area_nssa(Ro_area_nssaContext ctx) {
    OspfProcess proc = _currentOspfProcess;
    long area = (ctx.area_int != null) ? toLong(ctx.area_int) : toIp(ctx.area_ip).asLong();
    boolean noSummary = ctx.NO_SUMMARY() != null;
    boolean defaultOriginate = ctx.DEFAULT_INFORMATION_ORIGINATE() != null;
    boolean noRedstribution = ctx.NO_REDISTRIBUTION() != null;
    if (defaultOriginate) {
        todo(ctx, F_OSPF_AREA_NSSA_DEFAULT_ORIGINATE);
    }
    if (noRedstribution) {
        todo(ctx, F_OSPF_AREA_NSSA_NO_REDISTRIBUTION);
    }
    proc.getNssas().put(area, noSummary);
}
Also used : OspfProcess(org.batfish.representation.cisco.OspfProcess)

Example 4 with OspfProcess

use of org.batfish.representation.cisco.OspfProcess in project batfish by batfish.

the class CiscoControlPlaneExtractor method exitRo_redistribute_static.

@Override
public void exitRo_redistribute_static(Ro_redistribute_staticContext ctx) {
    OspfProcess proc = _currentOspfProcess;
    RoutingProtocol sourceProtocol = RoutingProtocol.STATIC;
    OspfRedistributionPolicy r = new OspfRedistributionPolicy(sourceProtocol);
    proc.getRedistributionPolicies().put(sourceProtocol, r);
    if (ctx.metric != null) {
        int metric = toInteger(ctx.metric);
        r.setMetric(metric);
    }
    if (ctx.map != null) {
        String map = ctx.map.getText();
        int mapLine = ctx.map.getLine();
        r.setRouteMap(map);
        r.setRouteMapLine(mapLine);
    }
    if (ctx.type != null) {
        int typeInt = toInteger(ctx.type);
        OspfMetricType type = OspfMetricType.fromInteger(typeInt);
        r.setOspfMetricType(type);
    } else {
        r.setOspfMetricType(OspfRedistributionPolicy.DEFAULT_METRIC_TYPE);
    }
    if (ctx.tag != null) {
        long tag = toLong(ctx.tag);
        r.setTag(tag);
    }
    r.setSubnets(ctx.subnets != null);
}
Also used : RoutingProtocol(org.batfish.datamodel.RoutingProtocol) OspfMetricType(org.batfish.datamodel.OspfMetricType) RoutePolicySetOspfMetricType(org.batfish.representation.cisco.RoutePolicySetOspfMetricType) OspfRedistributionPolicy(org.batfish.representation.cisco.OspfRedistributionPolicy) OspfProcess(org.batfish.representation.cisco.OspfProcess)

Example 5 with OspfProcess

use of org.batfish.representation.cisco.OspfProcess in project batfish by batfish.

the class CiscoControlPlaneExtractor method enterRo_vrf.

@Override
public void enterRo_vrf(Ro_vrfContext ctx) {
    Ip routerId = _currentOspfProcess.getRouterId();
    _currentVrf = ctx.name.getText();
    OspfProcess proc = currentVrf().getOspfProcess();
    if (proc == null) {
        proc = new OspfProcess(_currentOspfProcess.getName(), _format);
        currentVrf().setOspfProcess(proc);
        proc.setRouterId(routerId);
    }
    _currentOspfProcess = proc;
}
Also used : Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp) OspfProcess(org.batfish.representation.cisco.OspfProcess)

Aggregations

OspfProcess (org.batfish.representation.cisco.OspfProcess)9 OspfMetricType (org.batfish.datamodel.OspfMetricType)4 RoutePolicySetOspfMetricType (org.batfish.representation.cisco.RoutePolicySetOspfMetricType)4 RoutingProtocol (org.batfish.datamodel.RoutingProtocol)3 OspfRedistributionPolicy (org.batfish.representation.cisco.OspfRedistributionPolicy)3 Ip (org.batfish.datamodel.Ip)1 RoutePolicyNextHopIp (org.batfish.representation.cisco.RoutePolicyNextHopIp)1