@Override public void exitRo_default_information(Ro_default_informationContext ctx) { OspfProcess proc = _currentOspfProcess; proc.setDefaultInformationOriginate(true); boolean always = ctx.ALWAYS().size() > 0; proc.setDefaultInformationOriginateAlways(always); if (ctx.metric != null) { int metric = toInteger(ctx.metric); proc.setDefaultInformationMetric(metric); } if (ctx.metric_type != null) { int metricTypeInt = toInteger(ctx.metric_type); OspfMetricType metricType = OspfMetricType.fromInteger(metricTypeInt); proc.setDefaultInformationMetricType(metricType); } if (ctx.map != null) { String map = ctx.map.getText(); int line = ctx.map.getLine(); proc.setDefaultInformationOriginateMap(map); proc.setDefaultInformationOriginateMapLine(line); _configuration.referenceStructure(ROUTE_MAP, map, OSPF_DEFAULT_ORIGINATE_ROUTE_MAP, line); } }
@Override public void exitRo_redistribute_eigrp(Ro_redistribute_eigrpContext ctx) { OspfProcess proc = _currentOspfProcess; RoutingProtocol sourceProtocol = RoutingProtocol.EIGRP; OspfRedistributionPolicy r = new OspfRedistributionPolicy(sourceProtocol); proc.getRedistributionPolicies().put(sourceProtocol, r); long asn = toLong(ctx.tag); r.getSpecialAttributes().put(OspfRedistributionPolicy.EIGRP_AS_NUMBER, asn); if (ctx.metric != null) { int metric = toInteger(ctx.metric); r.setMetric(metric); } 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.map != null) { String map = ctx.map.getText(); int mapLine = ctx.map.getStart().getLine(); r.setRouteMap(map); r.setRouteMapLine(mapLine); _configuration.referenceStructure(ROUTE_MAP, map, OSPF_REDISTRIBUTE_EIGRP_MAP, mapLine); } r.setOnlyClassfulRoutes(ctx.SUBNETS().isEmpty() && !ospfRedistributeSubnetsByDefault(_format)); }
@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); _configuration.referenceStructure(ROUTE_MAP, map, OSPF_REDISTRIBUTE_CONNECTED_MAP, 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.setOnlyClassfulRoutes(ctx.subnets == null && !ospfRedistributeSubnetsByDefault(_format)); }
OspfMetricType type = OspfMetricType.fromInteger(typeInt); r.setOspfMetricType(type); } else {
@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); _configuration.referenceStructure(ROUTE_MAP, map, OSPF_REDISTRIBUTE_STATIC_MAP, 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.setOnlyClassfulRoutes(ctx.subnets == null && !ospfRedistributeSubnetsByDefault(_format)); }