Search in sources :

Example 1 with MultipliedAs

use of org.batfish.datamodel.routing_policy.expr.MultipliedAs 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)

Example 2 with MultipliedAs

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

the class TransferSSA 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

BatfishException (org.batfish.common.BatfishException)2 IntExpr (org.batfish.datamodel.routing_policy.expr.IntExpr)2 LiteralAsList (org.batfish.datamodel.routing_policy.expr.LiteralAsList)2 LiteralInt (org.batfish.datamodel.routing_policy.expr.LiteralInt)2 MultipliedAs (org.batfish.datamodel.routing_policy.expr.MultipliedAs)2