use of org.batfish.representation.cisco.BgpProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterVrf_block_rb_stanza.
@Override
public void enterVrf_block_rb_stanza(Vrf_block_rb_stanzaContext ctx) {
_currentVrf = ctx.name.getText();
int procNum = _configuration.getVrfs().get(Configuration.DEFAULT_VRF_NAME).getBgpProcess().getName();
BgpProcess proc = new BgpProcess(_format, procNum);
currentVrf().setBgpProcess(proc);
pushPeer(proc.getMasterBgpPeerGroup());
_currentBlockNeighborAddressFamilies.clear();
_inBlockNeighbor = false;
}
use of org.batfish.representation.cisco.BgpProcess 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);
}
}
}
}
use of org.batfish.representation.cisco.BgpProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitAlways_compare_med_rb_stanza.
@Override
public void exitAlways_compare_med_rb_stanza(Always_compare_med_rb_stanzaContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
proc.setAlwaysCompareMed(true);
}
use of org.batfish.representation.cisco.BgpProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterNeighbor_group_rb_stanza.
@Override
public void enterNeighbor_group_rb_stanza(Neighbor_group_rb_stanzaContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
String name = ctx.name.getText();
int definitionLine = ctx.name.getStart().getLine();
_currentNamedPeerGroup = proc.getNamedPeerGroups().get(name);
if (_currentNamedPeerGroup == null) {
proc.addNamedPeerGroup(name, definitionLine);
_currentNamedPeerGroup = proc.getNamedPeerGroups().get(name);
}
pushPeer(_currentNamedPeerGroup);
}
use of org.batfish.representation.cisco.BgpProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitUse_session_group_bgp_tail.
@Override
public void exitUse_session_group_bgp_tail(Use_session_group_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