use of org.batfish.representation.cisco.BgpRedistributionPolicy 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");
}
}
use of org.batfish.representation.cisco.BgpRedistributionPolicy in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRedistribute_static_bgp_tail.
@Override
public void exitRedistribute_static_bgp_tail(Redistribute_static_bgp_tailContext ctx) {
BgpProcess proc = currentVrf().getBgpProcess();
// Intentional identity comparison
if (_currentPeerGroup == proc.getMasterBgpPeerGroup()) {
RoutingProtocol sourceProtocol = RoutingProtocol.STATIC;
BgpRedistributionPolicy r = new BgpRedistributionPolicy(sourceProtocol);
proc.getRedistributionPolicies().put(sourceProtocol, r);
if (ctx.metric != null) {
long metric = toLong(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.representation.cisco.BgpRedistributionPolicy 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.representation.cisco.BgpRedistributionPolicy 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