Search in sources :

Example 1 with RouteMap

use of org.batfish.representation.cisco.RouteMap in project batfish by batfish.

the class CiscoControlPlaneExtractor method enterRoute_map_stanza.

@Override
public void enterRoute_map_stanza(Route_map_stanzaContext ctx) {
    String name = ctx.name.getText();
    int definitionLine = ctx.name.getStart().getLine();
    RouteMap routeMap = _configuration.getRouteMaps().computeIfAbsent(name, n -> new RouteMap(n, definitionLine));
    _currentRouteMap = routeMap;
    int num = toInteger(ctx.num);
    LineAction action = toLineAction(ctx.rmt);
    RouteMapClause clause = _currentRouteMap.getClauses().get(num);
    if (clause == null) {
        clause = new RouteMapClause(action, name, num);
        routeMap.getClauses().put(num, clause);
    } else {
        _w.redFlag("Route map '" + _currentRouteMap.getName() + "' already contains clause numbered '" + num + "'. Duplicate clause will be merged with original clause.");
    }
    _currentRouteMapClause = clause;
}
Also used : LineAction(org.batfish.datamodel.LineAction) RouteMapClause(org.batfish.representation.cisco.RouteMapClause) RouteMap(org.batfish.representation.cisco.RouteMap)

Aggregations

LineAction (org.batfish.datamodel.LineAction)1 RouteMap (org.batfish.representation.cisco.RouteMap)1 RouteMapClause (org.batfish.representation.cisco.RouteMapClause)1