use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class MatchIpAccessList method evaluate.
@Override
public Result evaluate(Environment environment) {
Result result = new Result();
IpAccessList list = environment.getConfiguration().getIpAccessLists().get(_list);
if (list != null) {
// TODO
} else {
environment.setError(true);
result.setBooleanValue(false);
return result;
}
throw new UnsupportedOperationException("no implementation for generated method");
}
use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class MatchIpv6 method evaluate.
@Override
public Result evaluate(Environment environment) {
boolean match = environment.getOriginalRoute6() != null;
Result result = new Result();
result.setBooleanValue(match);
return result;
}
use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class DisjunctionChain method evaluate.
@Override
public Result evaluate(Environment environment) {
Result subroutineResult = new Result();
subroutineResult.setFallThrough(true);
for (BooleanExpr subroutine : _subroutines) {
subroutineResult = subroutine.evaluate(environment);
if (subroutineResult.getExit()) {
return subroutineResult;
} else if (!subroutineResult.getFallThrough() && subroutineResult.getBooleanValue()) {
subroutineResult.setReturn(true);
return subroutineResult;
}
}
if (!subroutineResult.getFallThrough()) {
return subroutineResult;
} else {
String defaultPolicy = environment.getDefaultPolicy();
if (defaultPolicy != null) {
CallExpr callDefaultPolicy = new CallExpr(environment.getDefaultPolicy());
Result defaultPolicyResult = callDefaultPolicy.evaluate(environment);
return defaultPolicyResult;
} else {
throw new BatfishException("Default policy not set");
}
}
}
use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class Disjunction method evaluate.
@Override
public Result evaluate(Environment environment) {
for (BooleanExpr disjunct : _disjuncts) {
Result disjunctResult = disjunct.evaluate(environment);
if (disjunctResult.getExit()) {
return disjunctResult;
} else if (disjunctResult.getBooleanValue()) {
disjunctResult.setReturn(false);
return disjunctResult;
}
}
Result result = new Result();
result.setBooleanValue(false);
return result;
}
use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class DeleteCommunity method execute.
@Override
public Result execute(Environment environment) {
BgpRoute.Builder outputRouteBuilder = (BgpRoute.Builder) environment.getOutputRoute();
SortedSet<Long> currentCommunities = outputRouteBuilder.getCommunities();
SortedSet<Long> matchingCommunities = _expr.communities(environment, currentCommunities);
outputRouteBuilder.getCommunities().removeAll(matchingCommunities);
Result result = new Result();
return result;
}
Aggregations