use of org.batfish.representation.cisco.OspfRedistributionPolicy in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRo_redistribute_static.
@Override
public void exitRo_redistribute_static(Ro_redistribute_staticContext ctx) {
OspfProcess proc = _currentOspfProcess;
RoutingProtocol sourceProtocol = RoutingProtocol.STATIC;
OspfRedistributionPolicy r = new OspfRedistributionPolicy(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.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.representation.cisco.OspfRedistributionPolicy in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRo_redistribute_connected.
@Override
public void exitRo_redistribute_connected(Ro_redistribute_connectedContext ctx) {
OspfProcess proc = _currentOspfProcess;
RoutingProtocol sourceProtocol = RoutingProtocol.CONNECTED;
OspfRedistributionPolicy r = new OspfRedistributionPolicy(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.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.representation.cisco.OspfRedistributionPolicy 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);
}
Aggregations