use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class MatchProtocol method evaluate.
@Override
public Result evaluate(Environment environment) {
Result result = new Result();
boolean value = environment.getOriginalRoute().getProtocol().equals(_protocol);
result.setBooleanValue(value);
return result;
}
use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class SetLocalPreference method execute.
@Override
public Result execute(Environment environment) {
Result result = new Result();
BgpRoute.Builder bgpBuilder = (BgpRoute.Builder) environment.getOutputRoute();
int localPreference = _localPreference.evaluate(environment);
bgpBuilder.setLocalPreference(localPreference);
if (environment.getWriteToIntermediateBgpAttributes()) {
environment.getIntermediateBgpAttributes().setLocalPreference(localPreference);
}
return result;
}
use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class SetTag method execute.
@Override
public Result execute(Environment environment) {
Result result = new Result();
int tag = _tag.evaluate(environment);
environment.getOutputRoute().setTag(tag);
if (environment.getWriteToIntermediateBgpAttributes()) {
environment.getIntermediateBgpAttributes().setTag(tag);
}
return result;
}
use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class MatchCommunitySet method evaluate.
@Override
public Result evaluate(Environment environment) {
Result result = new Result();
boolean match = false;
SortedSet<Long> inputCommunities = null;
if (environment.getUseOutputAttributes() && environment.getOutputRoute() instanceof BgpRoute.Builder) {
BgpRoute.Builder bgpRouteBuilder = (BgpRoute.Builder) environment.getOutputRoute();
inputCommunities = bgpRouteBuilder.getCommunities();
} else if (environment.getReadFromIntermediateBgpAttributes()) {
inputCommunities = environment.getIntermediateBgpAttributes().getCommunities();
} else if (environment.getOriginalRoute() instanceof BgpRoute) {
BgpRoute bgpRoute = (BgpRoute) environment.getOriginalRoute();
inputCommunities = bgpRoute.getCommunities();
}
if (inputCommunities != null) {
match = _expr.matchSingleCommunity(environment, inputCommunities);
}
result.setBooleanValue(match);
return result;
}
use of org.batfish.datamodel.routing_policy.Result in project batfish by batfish.
the class MatchIpv4 method evaluate.
@Override
public Result evaluate(Environment environment) {
boolean match = environment.getOriginalRoute() != null;
Result result = new Result();
result.setBooleanValue(match);
return result;
}
Aggregations