use of org.batfish.common.BatfishException in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterIp_community_list_expanded_stanza.
@Override
public void enterIp_community_list_expanded_stanza(Ip_community_list_expanded_stanzaContext ctx) {
String name;
int definitionLine;
if (ctx.num != null) {
name = ctx.num.getText();
definitionLine = ctx.num.getLine();
} else if (ctx.name != null) {
name = ctx.name.getText();
definitionLine = ctx.name.getStart().getLine();
} else {
throw new BatfishException("Invalid community-list name");
}
_currentExpandedCommunityList = _configuration.getExpandedCommunityLists().computeIfAbsent(name, n -> new ExpandedCommunityList(n, definitionLine));
}
use of org.batfish.common.BatfishException in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitInherit_peer_policy_bgp_tail.
@Override
public void exitInherit_peer_policy_bgp_tail(Inherit_peer_policy_bgp_tailContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
String groupName = ctx.name.getText();
int line = ctx.name.getStart().getLine();
if (_currentIpPeerGroup != null) {
_currentIpPeerGroup.setGroupName(groupName);
_currentIpPeerGroup.setGroupNameLine(line);
} else if (_currentNamedPeerGroup != null) {
// May not hit this since parser for peer-policy does not have
// recursion.
_currentNamedPeerGroup.setGroupName(groupName);
_currentNamedPeerGroup.setGroupNameLine(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);
}
}
use of org.batfish.common.BatfishException in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterStandard_access_list_stanza.
@Override
public void enterStandard_access_list_stanza(Standard_access_list_stanzaContext ctx) {
String name;
int definitionLine;
if (ctx.name != null) {
name = ctx.name.getText();
definitionLine = ctx.name.getStart().getLine();
} else if (ctx.num != null) {
name = ctx.num.getText();
definitionLine = ctx.num.getLine();
} else {
throw new BatfishException("Invalid standard access-list name");
}
StandardAccessList list = _configuration.getStandardAcls().computeIfAbsent(name, n -> new StandardAccessList(n, definitionLine));
_currentStandardAcl = list;
}
use of org.batfish.common.BatfishException in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterCis_policy.
@Override
public void enterCis_policy(Cis_policyContext ctx) {
if (_currentIsakmpPolicy != null) {
throw new BatfishException("IsakmpPolicy should be null!");
}
_currentIsakmpPolicy = new IsakmpPolicy(ctx.name.getText(), ctx.getStart().getLine());
_currentIsakmpPolicy.getProposal().setAuthenticationAlgorithm(IkeAuthenticationAlgorithm.SHA1);
}
use of org.batfish.common.BatfishException in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRemote_as_bgp_tail.
@Override
public void exitRemote_as_bgp_tail(Remote_as_bgp_tailContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
int as = toInteger(ctx.as);
if (_currentPeerGroup != proc.getMasterBgpPeerGroup()) {
_currentPeerGroup.setRemoteAs(as);
} else {
throw new BatfishException("no peer or peer group in context: " + getLocation(ctx) + getFullText(ctx));
}
}
Aggregations