Search in sources :

Example 1 with OspfRedistributionPolicy

use of org.batfish.representation.cisco.OspfRedistributionPolicy 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 2 with OspfRedistributionPolicy

use of org.batfish.representation.cisco.OspfRedistributionPolicy 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 3 with OspfRedistributionPolicy

use of org.batfish.representation.cisco.OspfRedistributionPolicy 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

OspfMetricType (org.batfish.datamodel.OspfMetricType)3 RoutingProtocol (org.batfish.datamodel.RoutingProtocol)3 OspfProcess (org.batfish.representation.cisco.OspfProcess)3 OspfRedistributionPolicy (org.batfish.representation.cisco.OspfRedistributionPolicy)3 RoutePolicySetOspfMetricType (org.batfish.representation.cisco.RoutePolicySetOspfMetricType)3