Search in sources :

Example 1 with NamedAsPathSet

use of org.batfish.datamodel.routing_policy.expr.NamedAsPathSet in project batfish by batfish.

the class RoutePolicyBooleanAsPathIn method toBooleanExpr.

@Override
public BooleanExpr toBooleanExpr(CiscoConfiguration cc, Configuration c, Warnings w) {
    if (_asExpr instanceof NamedAsPathSet) {
        NamedAsPathSet named = (NamedAsPathSet) _asExpr;
        String name = named.getName();
        AsPathSet asPathSet = cc.getAsPathSets().get(name);
        if (asPathSet == null) {
            cc.undefined(CiscoStructureType.AS_PATH_SET, name, CiscoStructureUsage.ROUTE_POLICY_AS_PATH_IN, _expressionLine);
            return BooleanExprs.False.toStaticBooleanExpr();
        } else {
            asPathSet.getReferers().put(this, "as-path in");
        }
    }
    MatchAsPath match = new MatchAsPath(_asExpr);
    return match;
}
Also used : NamedAsPathSet(org.batfish.datamodel.routing_policy.expr.NamedAsPathSet) NamedAsPathSet(org.batfish.datamodel.routing_policy.expr.NamedAsPathSet) MatchAsPath(org.batfish.datamodel.routing_policy.expr.MatchAsPath)

Example 2 with NamedAsPathSet

use of org.batfish.datamodel.routing_policy.expr.NamedAsPathSet in project batfish by batfish.

the class RouteMapMatchAsPathAccessListLine method toBooleanExpr.

@Override
public BooleanExpr toBooleanExpr(Configuration c, CiscoConfiguration cc, Warnings w) {
    Disjunction d = new Disjunction();
    List<BooleanExpr> disjuncts = d.getDisjuncts();
    for (String listName : _listNames) {
        IpAsPathAccessList list = cc.getAsPathAccessLists().get(listName);
        if (list != null) {
            list.getReferers().put(this, "route-map match ip as-path access-list");
            disjuncts.add(new MatchAsPath(new NamedAsPathSet(listName)));
        } else {
            cc.undefined(CiscoStructureType.AS_PATH_ACCESS_LIST, listName, CiscoStructureUsage.ROUTE_MAP_MATCH_AS_PATH_ACCESS_LIST, _statementLine);
        }
    }
    return d.simplify();
}
Also used : Disjunction(org.batfish.datamodel.routing_policy.expr.Disjunction) NamedAsPathSet(org.batfish.datamodel.routing_policy.expr.NamedAsPathSet) MatchAsPath(org.batfish.datamodel.routing_policy.expr.MatchAsPath) BooleanExpr(org.batfish.datamodel.routing_policy.expr.BooleanExpr)

Aggregations

MatchAsPath (org.batfish.datamodel.routing_policy.expr.MatchAsPath)2 NamedAsPathSet (org.batfish.datamodel.routing_policy.expr.NamedAsPathSet)2 BooleanExpr (org.batfish.datamodel.routing_policy.expr.BooleanExpr)1 Disjunction (org.batfish.datamodel.routing_policy.expr.Disjunction)1