Search in sources :

Example 1 with IsisRedistributionPolicy

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

the class CiscoControlPlaneExtractor method exitRedistribute_static_is_stanza.

@Override
public void exitRedistribute_static_is_stanza(Redistribute_static_is_stanzaContext ctx) {
    IsisProcess proc = currentVrf().getIsisProcess();
    RoutingProtocol sourceProtocol = RoutingProtocol.STATIC;
    IsisRedistributionPolicy r = new IsisRedistributionPolicy(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();
        r.setMap(map);
    }
    if (ctx.LEVEL_1() != null) {
        r.setLevel(IsisLevel.LEVEL_1);
    } else if (ctx.LEVEL_2() != null) {
        r.setLevel(IsisLevel.LEVEL_2);
    } else if (ctx.LEVEL_1_2() != null) {
        r.setLevel(IsisLevel.LEVEL_1_2);
    } else {
        r.setLevel(IsisRedistributionPolicy.DEFAULT_LEVEL);
    }
}
Also used : RoutingProtocol(org.batfish.datamodel.RoutingProtocol) IsisProcess(org.batfish.representation.cisco.IsisProcess) IsisRedistributionPolicy(org.batfish.representation.cisco.IsisRedistributionPolicy)

Example 2 with IsisRedistributionPolicy

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

the class CiscoControlPlaneExtractor method exitSummary_address_is_stanza.

// @Override
// public void exitSubnet_bgp_tail(Subnet_bgp_tailContext ctx) {
// BgpProcess proc = currentVrf().getBgpProcess();
// if (ctx.IP_PREFIX() != null) {
// Prefix prefix = new Prefix(ctx.IP_PREFIX().getText());
// NamedBgpPeerGroup namedGroup = _currentNamedPeerGroup;
// namedGroup.addNeighborIpPrefix(prefix);
// DynamicIpBgpPeerGroup pg = proc.addDynamicIpPeerGroup(prefix);
// pg.setGroupName(namedGroup.getName());
// }
// else if (ctx.IPV6_PREFIX() != null) {
// Prefix6 prefix6 = new Prefix6(ctx.IPV6_PREFIX().getText());
// NamedBgpPeerGroup namedGroup = _currentNamedPeerGroup;
// namedGroup.addNeighborIpv6Prefix(prefix6);
// DynamicIpv6BgpPeerGroup pg = proc.addDynamicIpv6PeerGroup(prefix6);
// pg.setGroupName(namedGroup.getName());
// }
// }
// 
@Override
public void exitSummary_address_is_stanza(Summary_address_is_stanzaContext ctx) {
    Ip ip = toIp(ctx.ip);
    Ip mask = toIp(ctx.mask);
    Prefix prefix = new Prefix(ip, mask);
    RoutingProtocol sourceProtocol = RoutingProtocol.ISIS_L1;
    IsisRedistributionPolicy r = new IsisRedistributionPolicy(sourceProtocol);
    r.setSummaryPrefix(prefix);
    _currentIsisProcess.getRedistributionPolicies().put(sourceProtocol, r);
    if (ctx.metric != null) {
        int metric = toInteger(ctx.metric);
        r.setMetric(metric);
    }
    if (!ctx.LEVEL_1().isEmpty()) {
        r.setLevel(IsisLevel.LEVEL_1);
    } else if (!ctx.LEVEL_2().isEmpty()) {
        r.setLevel(IsisLevel.LEVEL_2);
    } else if (!ctx.LEVEL_1_2().isEmpty()) {
        r.setLevel(IsisLevel.LEVEL_1_2);
    } else {
        r.setLevel(IsisRedistributionPolicy.DEFAULT_LEVEL);
    }
}
Also used : RoutingProtocol(org.batfish.datamodel.RoutingProtocol) Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp) IsisRedistributionPolicy(org.batfish.representation.cisco.IsisRedistributionPolicy) Prefix(org.batfish.datamodel.Prefix)

Example 3 with IsisRedistributionPolicy

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

the class CiscoControlPlaneExtractor method exitRedistribute_connected_is_stanza.

@Override
public void exitRedistribute_connected_is_stanza(Redistribute_connected_is_stanzaContext ctx) {
    IsisProcess proc = currentVrf().getIsisProcess();
    RoutingProtocol sourceProtocol = RoutingProtocol.CONNECTED;
    IsisRedistributionPolicy r = new IsisRedistributionPolicy(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();
        r.setMap(map);
    }
    if (ctx.LEVEL_1() != null) {
        r.setLevel(IsisLevel.LEVEL_1);
    } else if (ctx.LEVEL_2() != null) {
        r.setLevel(IsisLevel.LEVEL_2);
    } else if (ctx.LEVEL_1_2() != null) {
        r.setLevel(IsisLevel.LEVEL_1_2);
    } else {
        r.setLevel(IsisRedistributionPolicy.DEFAULT_LEVEL);
    }
}
Also used : RoutingProtocol(org.batfish.datamodel.RoutingProtocol) IsisProcess(org.batfish.representation.cisco.IsisProcess) IsisRedistributionPolicy(org.batfish.representation.cisco.IsisRedistributionPolicy)

Aggregations

RoutingProtocol (org.batfish.datamodel.RoutingProtocol)3 IsisRedistributionPolicy (org.batfish.representation.cisco.IsisRedistributionPolicy)3 IsisProcess (org.batfish.representation.cisco.IsisProcess)2 Ip (org.batfish.datamodel.Ip)1 Prefix (org.batfish.datamodel.Prefix)1 RoutePolicyNextHopIp (org.batfish.representation.cisco.RoutePolicyNextHopIp)1