Search in sources :

Example 16 with MatchPrefixSet

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

the class OspfTest method getExportPolicyStatements.

private static List<Statement> getExportPolicyStatements(InterfaceAddress address) {
    long externalOspfMetric = 20L;
    If exportIfMatchL2Prefix = new If();
    exportIfMatchL2Prefix.setGuard(new MatchPrefixSet(new DestinationNetwork(), new ExplicitPrefixSet(new PrefixSpace(ImmutableSet.of(PrefixRange.fromPrefix(address.getPrefix()))))));
    exportIfMatchL2Prefix.setTrueStatements(ImmutableList.of(new SetOspfMetricType(OspfMetricType.E1), new SetMetric(new LiteralLong(externalOspfMetric)), Statements.ExitAccept.toStaticStatement()));
    exportIfMatchL2Prefix.setFalseStatements(ImmutableList.of(Statements.ExitReject.toStaticStatement()));
    return ImmutableList.of(exportIfMatchL2Prefix);
}
Also used : DestinationNetwork(org.batfish.datamodel.routing_policy.expr.DestinationNetwork) ExplicitPrefixSet(org.batfish.datamodel.routing_policy.expr.ExplicitPrefixSet) SetMetric(org.batfish.datamodel.routing_policy.statement.SetMetric) MatchPrefixSet(org.batfish.datamodel.routing_policy.expr.MatchPrefixSet) PrefixSpace(org.batfish.datamodel.PrefixSpace) SetOspfMetricType(org.batfish.datamodel.routing_policy.statement.SetOspfMetricType) LiteralLong(org.batfish.datamodel.routing_policy.expr.LiteralLong) If(org.batfish.datamodel.routing_policy.statement.If)

Aggregations

MatchPrefixSet (org.batfish.datamodel.routing_policy.expr.MatchPrefixSet)16 DestinationNetwork (org.batfish.datamodel.routing_policy.expr.DestinationNetwork)13 RouteFilterList (org.batfish.datamodel.RouteFilterList)9 RoutingPolicy (org.batfish.datamodel.routing_policy.RoutingPolicy)9 NamedPrefixSet (org.batfish.datamodel.routing_policy.expr.NamedPrefixSet)9 Prefix (org.batfish.datamodel.Prefix)8 BooleanExpr (org.batfish.datamodel.routing_policy.expr.BooleanExpr)8 Conjunction (org.batfish.datamodel.routing_policy.expr.Conjunction)8 If (org.batfish.datamodel.routing_policy.statement.If)8 SubRange (org.batfish.datamodel.SubRange)7 Disjunction (org.batfish.datamodel.routing_policy.expr.Disjunction)7 MatchProtocol (org.batfish.datamodel.routing_policy.expr.MatchProtocol)7 ArrayList (java.util.ArrayList)6 Not (org.batfish.datamodel.routing_policy.expr.Not)6 Statement (org.batfish.datamodel.routing_policy.statement.Statement)6 CallExpr (org.batfish.datamodel.routing_policy.expr.CallExpr)5 ExplicitPrefixSet (org.batfish.datamodel.routing_policy.expr.ExplicitPrefixSet)5 BatfishException (org.batfish.common.BatfishException)4 InterfaceAddress (org.batfish.datamodel.InterfaceAddress)4 PrefixRange (org.batfish.datamodel.PrefixRange)4