Search in sources :

Example 1 with IntExpr

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

the class CiscoControlPlaneExtractor method toRoutePolicyStatement.

private RoutePolicyStatement toRoutePolicyStatement(Prepend_as_path_rp_stanzaContext ctx) {
    AsExpr expr = toAsExpr(ctx.as);
    IntExpr number = null;
    if (ctx.number != null) {
        number = toIntExpr(ctx.number);
    }
    return new RoutePolicyPrependAsPath(expr, number);
}
Also used : AsExpr(org.batfish.datamodel.routing_policy.expr.AsExpr) RoutePolicyPrependAsPath(org.batfish.representation.cisco.RoutePolicyPrependAsPath) IntExpr(org.batfish.datamodel.routing_policy.expr.IntExpr)

Example 2 with IntExpr

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

the class CiscoControlPlaneExtractor method toSubRangeExpr.

private SubRangeExpr toSubRangeExpr(Rp_subrangeContext ctx) {
    IntExpr first = toCommonIntExpr(ctx.first);
    IntExpr last = first;
    if (ctx.last != null) {
        last = toCommonIntExpr(ctx.first);
    }
    return new SubRangeExpr(first, last);
}
Also used : SubRangeExpr(org.batfish.datamodel.routing_policy.expr.SubRangeExpr) IntExpr(org.batfish.datamodel.routing_policy.expr.IntExpr)

Example 3 with IntExpr

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

the class CiscoControlPlaneExtractor method exitSet_local_preference_rm_stanza.

@Override
public void exitSet_local_preference_rm_stanza(Set_local_preference_rm_stanzaContext ctx) {
    IntExpr localPreference = toLocalPreferenceIntExpr(ctx.pref);
    RouteMapSetLocalPreferenceLine line = new RouteMapSetLocalPreferenceLine(localPreference);
    _currentRouteMapClause.addSetLine(line);
}
Also used : IntExpr(org.batfish.datamodel.routing_policy.expr.IntExpr) RouteMapSetLocalPreferenceLine(org.batfish.representation.cisco.RouteMapSetLocalPreferenceLine)

Example 4 with IntExpr

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

the class CiscoControlPlaneExtractor method toRoutePolicyBoolean.

private RoutePolicyBoolean toRoutePolicyBoolean(Boolean_med_rp_stanzaContext ctx) {
    IntComparator cmp = toIntComparator(ctx.int_comp());
    IntExpr rhs = toCommonIntExpr(ctx.rhs);
    return new RoutePolicyBooleanMed(cmp, rhs);
}
Also used : RoutePolicyBooleanMed(org.batfish.representation.cisco.RoutePolicyBooleanMed) IntComparator(org.batfish.datamodel.routing_policy.expr.IntComparator) IntExpr(org.batfish.datamodel.routing_policy.expr.IntExpr)

Example 5 with IntExpr

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

the class TransferBDD method prependLength.

/*
   * Compute how many times to prepend to a path from the AST
   */
private int prependLength(AsPathListExpr expr) {
    if (expr instanceof MultipliedAs) {
        MultipliedAs x = (MultipliedAs) expr;
        IntExpr e = x.getNumber();
        LiteralInt i = (LiteralInt) e;
        return i.getValue();
    }
    if (expr instanceof LiteralAsList) {
        LiteralAsList x = (LiteralAsList) expr;
        return x.getList().size();
    }
    throw new BatfishException("Error[prependLength]: unreachable");
}
Also used : BatfishException(org.batfish.common.BatfishException) LiteralAsList(org.batfish.datamodel.routing_policy.expr.LiteralAsList) IntExpr(org.batfish.datamodel.routing_policy.expr.IntExpr) LiteralInt(org.batfish.datamodel.routing_policy.expr.LiteralInt) MultipliedAs(org.batfish.datamodel.routing_policy.expr.MultipliedAs)

Aggregations

IntExpr (org.batfish.datamodel.routing_policy.expr.IntExpr)10 BatfishException (org.batfish.common.BatfishException)4 IntComparator (org.batfish.datamodel.routing_policy.expr.IntComparator)3 LiteralAsList (org.batfish.datamodel.routing_policy.expr.LiteralAsList)3 LiteralInt (org.batfish.datamodel.routing_policy.expr.LiteralInt)3 MultipliedAs (org.batfish.datamodel.routing_policy.expr.MultipliedAs)3 HashSet (java.util.HashSet)2 Set (java.util.Set)2 OspfMetricType (org.batfish.datamodel.OspfMetricType)2 ArithExpr (com.microsoft.z3.ArithExpr)1 BitVecExpr (com.microsoft.z3.BitVecExpr)1 BoolExpr (com.microsoft.z3.BoolExpr)1 Expr (com.microsoft.z3.Expr)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 BDD (net.sf.javabdd.BDD)1 Pair (org.batfish.common.Pair)1