use of org.batfish.representation.cisco.DynamicIpv6BgpPeerGroup in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterNeighbor_block_rb_stanza.
@Override
public void enterNeighbor_block_rb_stanza(Neighbor_block_rb_stanzaContext ctx) {
_currentBlockNeighborAddressFamilies.clear();
_inBlockNeighbor = true;
// do no further processing for unsupported address families / containers
if (_currentPeerGroup == _dummyPeerGroup) {
pushPeer(_dummyPeerGroup);
return;
}
BgpProcess proc = currentVrf().getBgpProcess();
if (ctx.ip_address != null) {
Ip ip = toIp(ctx.ip_address);
_currentIpPeerGroup = proc.getIpPeerGroups().get(ip);
if (_currentIpPeerGroup == null) {
proc.addIpPeerGroup(ip);
_currentIpPeerGroup = proc.getIpPeerGroups().get(ip);
} else {
_w.redFlag("Duplicate IP peer group in neighbor config (line:" + ctx.start.getLine() + ")", DUPLICATE);
}
pushPeer(_currentIpPeerGroup);
} else if (ctx.ip_prefix != null) {
Prefix prefix = Prefix.parse(ctx.ip_prefix.getText());
_currentDynamicIpPeerGroup = proc.getDynamicIpPeerGroups().get(prefix);
if (_currentDynamicIpPeerGroup == null) {
_currentDynamicIpPeerGroup = proc.addDynamicIpPeerGroup(prefix);
} else {
_w.redFlag("Duplicate DynamicIP peer group neighbor config (line:" + ctx.start.getLine() + ")", DUPLICATE);
}
pushPeer(_currentDynamicIpPeerGroup);
} else if (ctx.ipv6_address != null) {
Ip6 ip6 = toIp6(ctx.ipv6_address);
Ipv6BgpPeerGroup pg = proc.getIpv6PeerGroups().get(ip6);
if (pg == null) {
proc.addIpv6PeerGroup(ip6);
pg = proc.getIpv6PeerGroups().get(ip6);
} else {
_w.redFlag("Duplicate IPV6 peer group in neighbor config (line:" + ctx.start.getLine() + ")", DUPLICATE);
}
pushPeer(pg);
_currentIpv6PeerGroup = pg;
} else if (ctx.ipv6_prefix != null) {
Prefix6 prefix6 = new Prefix6(ctx.ipv6_prefix.getText());
DynamicIpv6BgpPeerGroup pg = proc.getDynamicIpv6PeerGroups().get(prefix6);
if (pg == null) {
pg = proc.addDynamicIpv6PeerGroup(prefix6);
} else {
_w.redFlag("Duplicate Dynamic Ipv6 peer group neighbor config (line:" + ctx.start.getLine() + ")", DUPLICATE);
}
pushPeer(pg);
_currentDynamicIpv6PeerGroup = pg;
}
if (ctx.REMOTE_AS() != null) {
int remoteAs = toInteger(ctx.asnum);
_currentPeerGroup.setRemoteAs(remoteAs);
}
// TODO: verify if this is correct for nexus
_currentPeerGroup.setActive(true);
_currentPeerGroup.setShutdown(false);
}
use of org.batfish.representation.cisco.DynamicIpv6BgpPeerGroup in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitBgp_listen_range_rb_stanza.
@Override
public void exitBgp_listen_range_rb_stanza(Bgp_listen_range_rb_stanzaContext ctx) {
String name = ctx.name.getText();
int line = ctx.name.getStart().getLine();
BgpProcess proc = currentVrf().getBgpProcess();
if (ctx.IP_PREFIX() != null) {
Prefix prefix = Prefix.parse(ctx.IP_PREFIX().getText());
DynamicIpBgpPeerGroup pg = proc.addDynamicIpPeerGroup(prefix);
pg.setGroupName(name);
pg.setGroupNameLine(line);
if (ctx.as != null) {
int remoteAs = toInteger(ctx.as);
pg.setRemoteAs(remoteAs);
}
} else if (ctx.IPV6_PREFIX() != null) {
Prefix6 prefix6 = new Prefix6(ctx.IPV6_PREFIX().getText());
DynamicIpv6BgpPeerGroup pg = proc.addDynamicIpv6PeerGroup(prefix6);
pg.setGroupName(name);
pg.setGroupNameLine(line);
if (ctx.as != null) {
int remoteAs = toInteger(ctx.as);
pg.setRemoteAs(remoteAs);
}
}
}
Aggregations