Search in sources :

Example 6 with OspfProcess

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

the class CiscoControlPlaneExtractor method exitRo_redistribute_connected.

@Override
public void exitRo_redistribute_connected(Ro_redistribute_connectedContext ctx) {
    OspfProcess proc = _currentOspfProcess;
    RoutingProtocol sourceProtocol = RoutingProtocol.CONNECTED;
    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 7 with OspfProcess

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

the class CiscoControlPlaneExtractor method exitRo_default_metric.

@Override
public void exitRo_default_metric(Ro_default_metricContext ctx) {
    OspfProcess proc = _currentOspfProcess;
    if (ctx.NO() != null) {
        proc.setDefaultMetric(null);
    } else {
        long metric = toLong(ctx.metric);
        proc.setDefaultMetric(metric);
    }
}
Also used : OspfProcess(org.batfish.representation.cisco.OspfProcess)

Example 8 with OspfProcess

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

the class CiscoControlPlaneExtractor method enterS_router_ospf.

@Override
public void enterS_router_ospf(S_router_ospfContext ctx) {
    String procName = ctx.name.getText();
    if (ctx.vrf != null) {
        _currentVrf = ctx.vrf.getText();
    }
    OspfProcess proc = new OspfProcess(procName, _format);
    currentVrf().setOspfProcess(proc);
    _currentOspfProcess = proc;
}
Also used : OspfProcess(org.batfish.representation.cisco.OspfProcess)

Example 9 with OspfProcess

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

the class CiscoControlPlaneExtractor method exitRo_redistribute_bgp.

@Override
public void exitRo_redistribute_bgp(Ro_redistribute_bgpContext ctx) {
    OspfProcess proc = _currentOspfProcess;
    RoutingProtocol sourceProtocol = RoutingProtocol.BGP;
    OspfRedistributionPolicy r = new OspfRedistributionPolicy(sourceProtocol);
    proc.getRedistributionPolicies().put(sourceProtocol, r);
    int as = toInteger(ctx.as);
    r.getSpecialAttributes().put(OspfRedistributionPolicy.BGP_AS, as);
    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)

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