use of org.batfish.representation.cisco.OspfProcess 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.OspfProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method exitRo_default_metric.
@Override
public void exitRo_default_metric(Ro_default_metricContext ctx) {
OspfProcess proc = _currentOspfProcess;
if (ctx.NO() != null) {
proc.setDefaultMetric(null);
} else {
long metric = toLong(ctx.metric);
proc.setDefaultMetric(metric);
}
}
use of org.batfish.representation.cisco.OspfProcess in project batfish by batfish.
the class CiscoControlPlaneExtractor method enterS_router_ospf.
@Override
public void enterS_router_ospf(S_router_ospfContext ctx) {
String procName = ctx.name.getText();
if (ctx.vrf != null) {
_currentVrf = ctx.vrf.getText();
}
OspfProcess proc = new OspfProcess(procName, _format);
currentVrf().setOspfProcess(proc);
_currentOspfProcess = proc;
}
use of org.batfish.representation.cisco.OspfProcess 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