use of org.batfish.datamodel.RoutingProtocol in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitSummary_address_is_stanza.
// @Override
// public void exitSubnet_bgp_tail(Subnet_bgp_tailContext ctx) {
// BgpProcess proc = currentVrf().getBgpProcess();
// if (ctx.IP_PREFIX() != null) {
// Prefix prefix = new Prefix(ctx.IP_PREFIX().getText());
// NamedBgpPeerGroup namedGroup = _currentNamedPeerGroup;
// namedGroup.addNeighborIpPrefix(prefix);
// DynamicIpBgpPeerGroup pg = proc.addDynamicIpPeerGroup(prefix);
// pg.setGroupName(namedGroup.getName());
// }
// else if (ctx.IPV6_PREFIX() != null) {
// Prefix6 prefix6 = new Prefix6(ctx.IPV6_PREFIX().getText());
// NamedBgpPeerGroup namedGroup = _currentNamedPeerGroup;
// namedGroup.addNeighborIpv6Prefix(prefix6);
// DynamicIpv6BgpPeerGroup pg = proc.addDynamicIpv6PeerGroup(prefix6);
// pg.setGroupName(namedGroup.getName());
// }
// }
//
@Override
public void exitSummary_address_is_stanza(Summary_address_is_stanzaContext ctx) {
Ip ip = toIp(ctx.ip);
Ip mask = toIp(ctx.mask);
Prefix prefix = new Prefix(ip, mask);
RoutingProtocol sourceProtocol = RoutingProtocol.ISIS_L1;
IsisRedistributionPolicy r = new IsisRedistributionPolicy(sourceProtocol);
r.setSummaryPrefix(prefix);
_currentIsisProcess.getRedistributionPolicies().put(sourceProtocol, r);
if (ctx.metric != null) {
int metric = toInteger(ctx.metric);
r.setMetric(metric);
}
if (!ctx.LEVEL_1().isEmpty()) {
r.setLevel(IsisLevel.LEVEL_1);
} else if (!ctx.LEVEL_2().isEmpty()) {
r.setLevel(IsisLevel.LEVEL_2);
} else if (!ctx.LEVEL_1_2().isEmpty()) {
r.setLevel(IsisLevel.LEVEL_1_2);
} else {
r.setLevel(IsisRedistributionPolicy.DEFAULT_LEVEL);
}
}
use of org.batfish.datamodel.RoutingProtocol in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRo_redistribute_bgp.
@Override
public void exitRo_redistribute_bgp(Ro_redistribute_bgpContext ctx) {
OspfProcess proc = _currentOspfProcess;
RoutingProtocol sourceProtocol = RoutingProtocol.BGP;
OspfRedistributionPolicy r = new OspfRedistributionPolicy(sourceProtocol);
proc.getRedistributionPolicies().put(sourceProtocol, r);
int as = toInteger(ctx.as);
r.getSpecialAttributes().put(OspfRedistributionPolicy.BGP_AS, as);
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.getLine();
r.setRouteMap(map);
r.setRouteMapLine(mapLine);
}
if (ctx.type != null) {
int typeInt = toInteger(ctx.type);
OspfMetricType type = OspfMetricType.fromInteger(typeInt);
r.setOspfMetricType(type);
} else {
r.setOspfMetricType(OspfRedistributionPolicy.DEFAULT_METRIC_TYPE);
}
if (ctx.tag != null) {
long tag = toLong(ctx.tag);
r.setTag(tag);
}
r.setSubnets(ctx.subnets != null);
}
use of org.batfish.datamodel.RoutingProtocol in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRedistribute_connected_is_stanza.
@Override
public void exitRedistribute_connected_is_stanza(Redistribute_connected_is_stanzaContext ctx) {
IsisProcess proc = currentVrf().getIsisProcess();
RoutingProtocol sourceProtocol = RoutingProtocol.CONNECTED;
IsisRedistributionPolicy r = new IsisRedistributionPolicy(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();
r.setMap(map);
}
if (ctx.LEVEL_1() != null) {
r.setLevel(IsisLevel.LEVEL_1);
} else if (ctx.LEVEL_2() != null) {
r.setLevel(IsisLevel.LEVEL_2);
} else if (ctx.LEVEL_1_2() != null) {
r.setLevel(IsisLevel.LEVEL_1_2);
} else {
r.setLevel(IsisRedistributionPolicy.DEFAULT_LEVEL);
}
}
use of org.batfish.datamodel.RoutingProtocol 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.datamodel.RoutingProtocol in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRedistribute_connected_bgp_tail.
@Override
public void exitRedistribute_connected_bgp_tail(Redistribute_connected_bgp_tailContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
// Intentional identity comparison
if (_currentPeerGroup == proc.getMasterBgpPeerGroup()) {
RoutingProtocol sourceProtocol = RoutingProtocol.CONNECTED;
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");
}
}
Aggregations