Search in sources :

Example 1 with NamedBgpPeerGroup

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

the class CiscoControlPlaneExtractor method enterAf_group_rb_stanza.

@Override
public void enterAf_group_rb_stanza(Af_group_rb_stanzaContext ctx) {
    BgpProcess proc = currentVrf().getBgpProcess();
    String name = ctx.name.getText();
    int definitionLine = ctx.name.getStart().getLine();
    // String af = ctx.bgp_address_family().getText();
    NamedBgpPeerGroup afGroup = proc.getAfGroups().get(name);
    if (afGroup == null) {
        proc.addNamedPeerGroup(name, definitionLine);
        afGroup = proc.getNamedPeerGroups().get(name);
    }
    pushPeer(afGroup);
    _currentNamedPeerGroup = afGroup;
}
Also used : NamedBgpPeerGroup(org.batfish.representation.cisco.NamedBgpPeerGroup) BgpProcess(org.batfish.representation.cisco.BgpProcess)

Example 2 with NamedBgpPeerGroup

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

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

the class CiscoControlPlaneExtractor method exitPeer_group_creation_rb_stanza.

@Override
public void exitPeer_group_creation_rb_stanza(Peer_group_creation_rb_stanzaContext ctx) {
    String name = ctx.name.getText();
    int definitionLine = ctx.name.getLine();
    BgpProcess proc = currentVrf().getBgpProcess();
    if (proc.getNamedPeerGroups().get(name) == null) {
        proc.addNamedPeerGroup(name, definitionLine);
        if (ctx.PASSIVE() != null) {
            // dell: won't otherwise specify activation so just activate here
            NamedBgpPeerGroup npg = proc.getNamedPeerGroups().get(name);
            npg.setActive(true);
        }
    }
}
Also used : NamedBgpPeerGroup(org.batfish.representation.cisco.NamedBgpPeerGroup) BgpProcess(org.batfish.representation.cisco.BgpProcess)

Aggregations

BgpProcess (org.batfish.representation.cisco.BgpProcess)3 NamedBgpPeerGroup (org.batfish.representation.cisco.NamedBgpPeerGroup)3 Ip (org.batfish.datamodel.Ip)1 Ip6 (org.batfish.datamodel.Ip6)1 DynamicIpBgpPeerGroup (org.batfish.representation.cisco.DynamicIpBgpPeerGroup)1 DynamicIpv6BgpPeerGroup (org.batfish.representation.cisco.DynamicIpv6BgpPeerGroup)1 IpBgpPeerGroup (org.batfish.representation.cisco.IpBgpPeerGroup)1 Ipv6BgpPeerGroup (org.batfish.representation.cisco.Ipv6BgpPeerGroup)1 RoutePolicyNextHopIp (org.batfish.representation.cisco.RoutePolicyNextHopIp)1