use of org.batfish.representation.cisco.BgpAggregateIpv6Network in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitAggregate_address_rb_stanza.
@Override
public void exitAggregate_address_rb_stanza(Aggregate_address_rb_stanzaContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
// Intentional identity comparison
if (_currentPeerGroup == proc.getMasterBgpPeerGroup()) {
boolean summaryOnly = ctx.summary_only != null;
boolean asSet = ctx.as_set != null;
if (ctx.network != null || ctx.prefix != null) {
// ipv4
Prefix prefix;
if (ctx.network != null) {
Ip network = toIp(ctx.network);
Ip subnet = toIp(ctx.subnet);
int prefixLength = subnet.numSubnetBits();
prefix = new Prefix(network, prefixLength);
} else {
// ctx.prefix != null
prefix = Prefix.parse(ctx.prefix.getText());
}
BgpAggregateIpv4Network net = new BgpAggregateIpv4Network(prefix);
net.setAsSet(asSet);
net.setSummaryOnly(summaryOnly);
if (ctx.mapname != null) {
String mapName = ctx.mapname.getText();
int mapLine = ctx.mapname.getStart().getLine();
net.setAttributeMap(mapName);
net.setAttributeMapLine(mapLine);
}
proc.getAggregateNetworks().put(prefix, net);
} else if (ctx.ipv6_prefix != null) {
// ipv6
Prefix6 prefix6 = new Prefix6(ctx.ipv6_prefix.getText());
BgpAggregateIpv6Network net = new BgpAggregateIpv6Network(prefix6);
net.setAsSet(asSet);
net.setSummaryOnly(summaryOnly);
if (ctx.mapname != null) {
String mapName = ctx.mapname.getText();
int mapLine = ctx.mapname.getStart().getLine();
net.setAttributeMap(mapName);
net.setAttributeMapLine(mapLine);
}
proc.getAggregateIpv6Networks().put(prefix6, net);
}
} else if (_currentIpPeerGroup != null || _currentIpv6PeerGroup != null || _currentDynamicIpPeerGroup != null || _currentDynamicIpv6PeerGroup != null || _currentNamedPeerGroup != null) {
throw new BatfishException("unexpected occurrence in peer group/neighbor context");
} else if (ctx.mapname != null) {
String map = ctx.mapname.getText();
int line = ctx.mapname.getStart().getLine();
_configuration.getBgpVrfAggregateAddressRouteMaps().add(map);
_configuration.referenceStructure(CiscoStructureType.ROUTE_MAP, map, CiscoStructureUsage.BGP_VRF_AGGREGATE_ROUTE_MAP, line);
}
}
Aggregations