Search in sources :

Example 1 with Ip6

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

the class Ip6Prefix method evaluate.

@Override
public Prefix6 evaluate(Environment env) {
    Ip6 ip6 = _ip6.evaluate(env);
    int prefixLength = _prefixLength.evaluate(env);
    return new Prefix6(ip6, prefixLength);
}
Also used : Ip6(org.batfish.datamodel.Ip6) Prefix6(org.batfish.datamodel.Prefix6)

Example 2 with Ip6

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

the class CiscoControlPlaneExtractor method exitStandard_ipv6_access_list_tail.

@Override
public void exitStandard_ipv6_access_list_tail(Standard_ipv6_access_list_tailContext ctx) {
    LineAction action = toLineAction(ctx.ala);
    Ip6 srcIp = getIp(ctx.ipr);
    Ip6 srcWildcard = getWildcard(ctx.ipr);
    Set<Integer> dscps = new TreeSet<>();
    Set<Integer> ecns = new TreeSet<>();
    for (Standard_access_list_additional_featureContext feature : ctx.features) {
        if (feature.DSCP() != null) {
            int dscpType = toDscpType(feature.dscp_type());
            dscps.add(dscpType);
        } else if (feature.ECN() != null) {
            int ecn = toInteger(feature.ecn);
            ecns.add(ecn);
        }
    }
    String name;
    if (ctx.num != null) {
        name = ctx.num.getText();
    } else {
        name = getFullText(ctx).trim();
    }
    StandardIpv6AccessListLine line = new StandardIpv6AccessListLine(name, action, new Ip6Wildcard(srcIp, srcWildcard), dscps, ecns);
    _currentStandardIpv6Acl.addLine(line);
}
Also used : LineAction(org.batfish.datamodel.LineAction) Standard_access_list_additional_featureContext(org.batfish.grammar.cisco.CiscoParser.Standard_access_list_additional_featureContext) TreeSet(java.util.TreeSet) StandardIpv6AccessListLine(org.batfish.representation.cisco.StandardIpv6AccessListLine) Ip6(org.batfish.datamodel.Ip6) Ip6Wildcard(org.batfish.datamodel.Ip6Wildcard)

Example 3 with Ip6

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

the class CiscoControlPlaneExtractor method exitPeer_group_assignment_rb_stanza.

@Override
public void exitPeer_group_assignment_rb_stanza(Peer_group_assignment_rb_stanzaContext ctx) {
    String peerGroupName = ctx.name.getText();
    int line = ctx.name.getStart().getLine();
    BgpProcess proc = currentVrf().getBgpProcess();
    if (ctx.address != null) {
        Ip address = toIp(ctx.address);
        IpBgpPeerGroup ipPeerGroup = proc.getIpPeerGroups().get(address);
        if (ipPeerGroup == null) {
            proc.addIpPeerGroup(address);
            ipPeerGroup = proc.getIpPeerGroups().get(address);
        }
        ipPeerGroup.setGroupName(peerGroupName);
        ipPeerGroup.setGroupNameLine(line);
    } else if (ctx.address6 != null) {
        Ip6 address6 = toIp6(ctx.address6);
        Ipv6BgpPeerGroup ipv6PeerGroup = proc.getIpv6PeerGroups().get(address6);
        if (ipv6PeerGroup == null) {
            proc.addIpv6PeerGroup(address6);
            ipv6PeerGroup = proc.getIpv6PeerGroups().get(address6);
        }
        ipv6PeerGroup.setGroupName(peerGroupName);
        ipv6PeerGroup.setGroupNameLine(line);
    }
}
Also used : IpBgpPeerGroup(org.batfish.representation.cisco.IpBgpPeerGroup) DynamicIpBgpPeerGroup(org.batfish.representation.cisco.DynamicIpBgpPeerGroup) BgpProcess(org.batfish.representation.cisco.BgpProcess) Ipv6BgpPeerGroup(org.batfish.representation.cisco.Ipv6BgpPeerGroup) DynamicIpv6BgpPeerGroup(org.batfish.representation.cisco.DynamicIpv6BgpPeerGroup) Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp) Ip6(org.batfish.datamodel.Ip6)

Example 4 with Ip6

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

the class CiscoControlPlaneExtractor method exitNo_neighbor_activate_rb_stanza.

@Override
public void exitNo_neighbor_activate_rb_stanza(No_neighbor_activate_rb_stanzaContext ctx) {
    BgpProcess proc = currentVrf().getBgpProcess();
    if (ctx.ip != null) {
        Ip ip = toIp(ctx.ip);
        IpBgpPeerGroup pg = proc.getIpPeerGroups().get(ip);
        if (pg == null) {
            String message = "ignoring attempt to activate undefined ip peer group: " + ip;
            _w.redFlag(message);
        } else {
            pg.setActive(false);
        }
    } else if (ctx.ip6 != null) {
        Ip6 ip6 = toIp6(ctx.ip6);
        Ipv6BgpPeerGroup pg = proc.getIpv6PeerGroups().get(ip6);
        if (pg == null) {
            String message = "ignoring attempt to activate undefined ipv6 peer group: " + ip6;
            _w.redFlag(message);
        } else {
            pg.setActive(false);
        }
    } else if (ctx.peergroup != null) {
        String pgName = ctx.peergroup.getText();
        NamedBgpPeerGroup npg = proc.getNamedPeerGroups().get(pgName);
        npg.setActive(false);
        for (IpBgpPeerGroup ipg : proc.getIpPeerGroups().values()) {
            String currentGroupName = ipg.getGroupName();
            if (currentGroupName != null && currentGroupName.equals(pgName)) {
                ipg.setActive(false);
            }
        }
        for (Ipv6BgpPeerGroup ipg : proc.getIpv6PeerGroups().values()) {
            String currentGroupName = ipg.getGroupName();
            if (currentGroupName != null && currentGroupName.equals(pgName)) {
                ipg.setActive(false);
            }
        }
    }
}
Also used : IpBgpPeerGroup(org.batfish.representation.cisco.IpBgpPeerGroup) DynamicIpBgpPeerGroup(org.batfish.representation.cisco.DynamicIpBgpPeerGroup) NamedBgpPeerGroup(org.batfish.representation.cisco.NamedBgpPeerGroup) BgpProcess(org.batfish.representation.cisco.BgpProcess) Ipv6BgpPeerGroup(org.batfish.representation.cisco.Ipv6BgpPeerGroup) DynamicIpv6BgpPeerGroup(org.batfish.representation.cisco.DynamicIpv6BgpPeerGroup) Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp) Ip6(org.batfish.datamodel.Ip6)

Example 5 with Ip6

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

the class CiscoControlPlaneExtractor method exitNo_neighbor_shutdown_rb_stanza.

@Override
public void exitNo_neighbor_shutdown_rb_stanza(No_neighbor_shutdown_rb_stanzaContext ctx) {
    BgpProcess proc = currentVrf().getBgpProcess();
    if (ctx.ip != null) {
        Ip ip = toIp(ctx.ip);
        IpBgpPeerGroup pg = proc.getIpPeerGroups().get(ip);
        // TODO: see if it is always ok to set active on 'no shutdown'
        if (pg == null) {
            String message = "ignoring attempt to shut down to undefined ip peer group: " + ip;
            _w.redFlag(message);
        } else {
            pg.setActive(true);
            pg.setShutdown(false);
        }
    } else if (ctx.ip6 != null) {
        Ip6 ip6 = toIp6(ctx.ip6);
        Ipv6BgpPeerGroup pg = proc.getIpv6PeerGroups().get(ip6);
        // TODO: see if it is always ok to set active on 'no shutdown'
        if (pg == null) {
            String message = "ignoring attempt to shut down undefined ipv6 peer group: " + ip6;
            _w.redFlag(message);
        } else {
            pg.setActive(true);
            pg.setShutdown(false);
        }
    } else if (ctx.peergroup != null) {
        _w.redFlag("'no shutdown' of  peer group unsupported");
    }
}
Also used : IpBgpPeerGroup(org.batfish.representation.cisco.IpBgpPeerGroup) DynamicIpBgpPeerGroup(org.batfish.representation.cisco.DynamicIpBgpPeerGroup) BgpProcess(org.batfish.representation.cisco.BgpProcess) Ipv6BgpPeerGroup(org.batfish.representation.cisco.Ipv6BgpPeerGroup) DynamicIpv6BgpPeerGroup(org.batfish.representation.cisco.DynamicIpv6BgpPeerGroup) Ip(org.batfish.datamodel.Ip) RoutePolicyNextHopIp(org.batfish.representation.cisco.RoutePolicyNextHopIp) Ip6(org.batfish.datamodel.Ip6)

Aggregations

Ip6 (org.batfish.datamodel.Ip6)10 Ip (org.batfish.datamodel.Ip)5 BgpProcess (org.batfish.representation.cisco.BgpProcess)5 DynamicIpv6BgpPeerGroup (org.batfish.representation.cisco.DynamicIpv6BgpPeerGroup)5 Ipv6BgpPeerGroup (org.batfish.representation.cisco.Ipv6BgpPeerGroup)5 RoutePolicyNextHopIp (org.batfish.representation.cisco.RoutePolicyNextHopIp)5 Prefix6 (org.batfish.datamodel.Prefix6)4 LineAction (org.batfish.datamodel.LineAction)3 SubRange (org.batfish.datamodel.SubRange)3 DynamicIpBgpPeerGroup (org.batfish.representation.cisco.DynamicIpBgpPeerGroup)3 IpBgpPeerGroup (org.batfish.representation.cisco.IpBgpPeerGroup)3 TreeSet (java.util.TreeSet)2 Ip6Wildcard (org.batfish.datamodel.Ip6Wildcard)2 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 BatfishException (org.batfish.common.BatfishException)1 RedFlagBatfishException (org.batfish.common.RedFlagBatfishException)1 IpProtocol (org.batfish.datamodel.IpProtocol)1 Prefix (org.batfish.datamodel.Prefix)1 Route6FilterLine (org.batfish.datamodel.Route6FilterLine)1