Search in sources :

Example 1 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class ApplyGroupsApplicator method enterSet_line_tail.

@Override
public void enterSet_line_tail(Set_line_tailContext ctx) {
    _enablePathRecording = true;
    _currentPath = new HierarchyPath();
}
Also used : HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)

Example 2 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class ApplyPathApplicator method enterPoplt_apply_path.

@Override
public void enterPoplt_apply_path(Poplt_apply_pathContext ctx) {
    HierarchyPath applyPathPath = new HierarchyPath();
    String pathQuoted = ctx.path.getText();
    String pathWithoutQuotes = pathQuoted.substring(1, pathQuoted.length() - 1);
    String[] pathComponents = pathWithoutQuotes.split("\\s+");
    for (String pathComponent : pathComponents) {
        boolean isWildcard = pathComponent.charAt(0) == '<';
        if (isWildcard) {
            applyPathPath.addWildcardNode(pathComponent);
        } else {
            applyPathPath.addNode(pathComponent);
        }
    }
    int insertionIndex = _newConfigurationLines.indexOf(_currentSetLine);
    List<ParseTree> newLines = null;
    try {
        newLines = _hierarchy.getApplyPathLines(_currentPath, applyPathPath, _configurationContext);
    } catch (BatfishException e) {
        _w.redFlag("Could not apply path: " + pathQuoted + ": make sure path is terminated by wildcard (e.g. <*>) representing ip(v6) " + "addresses or prefixes");
    }
    if (newLines != null) {
        _newConfigurationLines.addAll(insertionIndex + 1, newLines);
    }
}
Also used : BatfishException(org.batfish.common.BatfishException) HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 3 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class ApplyPathApplicator method enterSet_line_tail.

@Override
public void enterSet_line_tail(Set_line_tailContext ctx) {
    _enablePathRecording = true;
    _currentPath = new HierarchyPath();
}
Also used : HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)

Example 4 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class DeactivatedLinePruner method enterSet_line_tail.

@Override
public void enterSet_line_tail(Set_line_tailContext ctx) {
    _enablePathRecording = true;
    _currentPath = new HierarchyPath();
}
Also used : HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)

Example 5 with HierarchyPath

use of org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath in project batfish by batfish.

the class GroupTreeBuilder method enterSet_line_tail.

@Override
public void enterSet_line_tail(Set_line_tailContext ctx) {
    _enablePathRecording = true;
    _currentPath = new HierarchyPath();
}
Also used : HierarchyPath(org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)

Aggregations

HierarchyPath (org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree.HierarchyPath)11 Token (org.antlr.v4.runtime.Token)1 Interval (org.antlr.v4.runtime.misc.Interval)1 ParseTree (org.antlr.v4.runtime.tree.ParseTree)1 BatfishException (org.batfish.common.BatfishException)1 StatementContext (org.batfish.grammar.flatjuniper.FlatJuniperParser.StatementContext)1 HierarchyTree (org.batfish.grammar.flatjuniper.Hierarchy.HierarchyTree)1