use of org.batfish.representation.cisco.BgpProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitNetwork6_bgp_tail.
@Override
public void exitNetwork6_bgp_tail(Network6_bgp_tailContext ctx) {
Prefix6 prefix6 = new Prefix6(ctx.prefix.getText());
String map = null;
Integer mapLine = null;
if (ctx.mapname != null) {
map = ctx.mapname.getText();
mapLine = ctx.mapname.getStart().getLine();
}
BgpProcess proc = currentVrf().getBgpProcess();
BgpNetwork6 bgpNetwork6 = new BgpNetwork6(prefix6, map, mapLine);
proc.getIpv6Networks().put(prefix6, bgpNetwork6);
}
use of org.batfish.representation.cisco.BgpProcess 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");
}
}
use of org.batfish.representation.cisco.BgpProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRedistribute_rip_bgp_tail.
@Override
public void exitRedistribute_rip_bgp_tail(Redistribute_rip_bgp_tailContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
// Intentional identity comparison
if (_currentPeerGroup == proc.getMasterBgpPeerGroup()) {
RoutingProtocol sourceProtocol = RoutingProtocol.RIP;
BgpRedistributionPolicy r = new BgpRedistributionPolicy(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.getStart().getLine();
r.setRouteMap(map);
r.setRouteMapLine(mapLine);
}
} else if (_currentIpPeerGroup != null || _currentNamedPeerGroup != null) {
throw new BatfishException("do not currently handle per-neighbor redistribution policies");
}
}
use of org.batfish.representation.cisco.BgpProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitMaximum_paths_bgp_tail.
@Override
public void exitMaximum_paths_bgp_tail(Maximum_paths_bgp_tailContext ctx) {
int maximumPaths = toInteger(ctx.paths);
BgpProcess proc = currentVrf().getBgpProcess();
if (ctx.EBGP() != null) {
proc.setMaximumPathsEbgp(maximumPaths);
} else if (ctx.IBGP() != null) {
proc.setMaximumPathsIbgp(maximumPaths);
} else if (ctx.EIBGP() != null) {
proc.setMaximumPathsEibgp(maximumPaths);
} else {
proc.setMaximumPaths(maximumPaths);
}
}
use of org.batfish.representation.cisco.BgpProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitInherit_peer_session_bgp_tail.
@Override
public void exitInherit_peer_session_bgp_tail(Inherit_peer_session_bgp_tailContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
String groupName = ctx.name.getText();
int line = ctx.name.getStart().getLine();
if (_currentIpPeerGroup != null) {
_currentIpPeerGroup.setPeerSession(groupName);
_currentIpPeerGroup.setPeerSessionLine(line);
} else if (_currentNamedPeerGroup != null) {
_currentNamedPeerGroup.setPeerSession(groupName);
_currentNamedPeerGroup.setPeerSessionLine(line);
} else if (_currentPeerGroup == proc.getMasterBgpPeerGroup()) {
// Intentional identity comparison above
throw new BatfishException("Invalid peer context for inheritance");
} else {
todo(ctx, F_BGP_INHERIT_PEER_SESSION_OTHER);
}
}
Aggregations