use of org.batfish.common.BatfishException in project batfish by batfish.
the class InitInfoAnswerElementTest method testSetErrors.
@Test
public void testSetErrors() {
BatfishException exception = new BatfishException("sample exception");
BatfishStackTrace stackTrace = new BatfishStackTrace(exception);
List<BatfishStackTrace> errors = new ArrayList<>();
errors.add(stackTrace);
SortedMap<String, List<BatfishStackTrace>> error = new TreeMap<>();
error.put("error", errors);
_element.setErrors(error);
assertThat(_element.getErrors().get("error"), is(errors));
}
use of org.batfish.common.BatfishException in project batfish by batfish.
the class ParseVendorConfigurationAnswerElementTest method testSetErrors.
@Test
public void testSetErrors() {
BatfishException exception = new BatfishException("sample exception");
BatfishStackTrace stackTrace = new BatfishStackTrace(exception);
SortedMap<String, BatfishStackTrace> errors = new TreeMap<>();
errors.put("error", stackTrace);
_element.setErrors(errors);
assertThat(_element.getErrors().get("error"), is(stackTrace));
}
use of org.batfish.common.BatfishException in project batfish by batfish.
the class ParseVendorConfigurationAnswerElementTest method checkNonEmptyErrors.
@Test
public void checkNonEmptyErrors() {
BatfishException exception = new BatfishException("sample exception");
_element.getErrors().put("error", new BatfishStackTrace(exception));
assertThat(_element.getErrors().size(), is(1));
}
use of org.batfish.common.BatfishException in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterExtended_access_list_stanza.
@Override
public void enterExtended_access_list_stanza(Extended_access_list_stanzaContext ctx) {
String name;
int definitionLine;
if (ctx.name != null) {
name = ctx.name.getText();
definitionLine = ctx.name.getStart().getLine();
} else if (ctx.shortname != null) {
name = ctx.shortname.getText();
definitionLine = ctx.shortname.getStart().getLine();
} else if (ctx.num != null) {
name = ctx.num.getText();
definitionLine = ctx.num.getLine();
} else {
throw new BatfishException("Could not determine acl name");
}
ExtendedAccessList list = _configuration.getExtendedAcls().computeIfAbsent(name, n -> new ExtendedAccessList(n, definitionLine));
_currentExtendedAcl = list;
}
use of org.batfish.common.BatfishException in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRedistribute_ospf_bgp_tail.
@Override
public void exitRedistribute_ospf_bgp_tail(Redistribute_ospf_bgp_tailContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
// Intentional identity comparison
if (_currentPeerGroup == proc.getMasterBgpPeerGroup()) {
RoutingProtocol sourceProtocol = RoutingProtocol.OSPF;
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);
}
int procNum = toInteger(ctx.procnum);
r.getSpecialAttributes().put(BgpRedistributionPolicy.OSPF_PROCESS_NUMBER, procNum);
} else if (_currentIpPeerGroup != null || _currentNamedPeerGroup != null) {
throw new BatfishException("do not currently handle per-neighbor redistribution policies");
}
}
Aggregations