Search in sources :

Example 1 with As_unitContext

use of org.batfish.grammar.flatjuniper.FlatJuniperParser.As_unitContext in project batfish by batfish.

the class ConfigurationBuilder method toAsPath.

private AsPath toAsPath(As_path_exprContext path) {
    List<SortedSet<Integer>> asPath = new ArrayList<>();
    for (As_unitContext ctx : path.items) {
        SortedSet<Integer> asSet = new TreeSet<>();
        if (ctx.DEC() != null) {
            asSet.add(toInt(ctx.DEC()));
        } else {
            for (Token token : ctx.as_set().items) {
                asSet.add(toInt(token));
            }
        }
        asPath.add(asSet);
    }
    return new AsPath(asPath);
}
Also used : PsFromAsPath(org.batfish.representation.juniper.PsFromAsPath) AsPath(org.batfish.datamodel.AsPath) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) As_unitContext(org.batfish.grammar.flatjuniper.FlatJuniperParser.As_unitContext) Token(org.antlr.v4.runtime.Token) SortedSet(java.util.SortedSet)

Aggregations

ArrayList (java.util.ArrayList)1 SortedSet (java.util.SortedSet)1 TreeSet (java.util.TreeSet)1 Token (org.antlr.v4.runtime.Token)1 AsPath (org.batfish.datamodel.AsPath)1 As_unitContext (org.batfish.grammar.flatjuniper.FlatJuniperParser.As_unitContext)1 PsFromAsPath (org.batfish.representation.juniper.PsFromAsPath)1