Search in sources :

Example 16 with If

use of org.batfish.datamodel.routing_policy.statement.If in project batfish by batfish.

the class Optimizations method computeKeepOspfType.

/*
   * Check if we need to keep around the OSPF type. If the type
   * is never set via redistribution, and there is a single area,
   * then it is unnecessary.
   */
private boolean computeKeepOspfType() {
    if (!Optimizations.ENABLE_SLICING_OPTIMIZATION) {
        return true;
    }
    // First check if the ospf metric type is ever set
    AstVisitor v = new AstVisitor();
    Boolean[] val = new Boolean[1];
    val[0] = false;
    _encoderSlice.getGraph().getConfigurations().forEach((router, conf) -> conf.getRoutingPolicies().forEach((name, pol) -> v.visit(conf, pol.getStatements(), stmt -> {
        if (stmt instanceof SetOspfMetricType) {
            val[0] = true;
        }
    }, expr -> {
    })));
    if (val[0]) {
        return true;
    }
    // Next see if the there are multiple ospf areas
    Set<Long> areaIds = new HashSet<>();
    _encoderSlice.getGraph().getConfigurations().forEach((router, conf) -> {
        Set<Long> ids = _encoderSlice.getGraph().getAreaIds().get(router);
        areaIds.addAll(ids);
    });
    return areaIds.size() > 1;
}
Also used : BooleanExpr(org.batfish.datamodel.routing_policy.expr.BooleanExpr) If(org.batfish.datamodel.routing_policy.statement.If) Statements(org.batfish.datamodel.routing_policy.statement.Statements) HashMap(java.util.HashMap) BatfishException(org.batfish.common.BatfishException) BgpProcess(org.batfish.datamodel.BgpProcess) ArrayList(java.util.ArrayList) Interface(org.batfish.datamodel.Interface) HashSet(java.util.HashSet) HeaderQuestion(org.batfish.datamodel.questions.smt.HeaderQuestion) RouteFilterLine(org.batfish.datamodel.RouteFilterLine) Map(java.util.Map) Configuration(org.batfish.datamodel.Configuration) Statement(org.batfish.datamodel.routing_policy.statement.Statement) Set(java.util.Set) Graph(org.batfish.symbolic.Graph) GraphEdge(org.batfish.symbolic.GraphEdge) List(java.util.List) AstVisitor(org.batfish.symbolic.AstVisitor) RoutingPolicy(org.batfish.datamodel.routing_policy.RoutingPolicy) CallExpr(org.batfish.datamodel.routing_policy.expr.CallExpr) GeneratedRoute(org.batfish.datamodel.GeneratedRoute) Protocol(org.batfish.symbolic.Protocol) BgpNeighbor(org.batfish.datamodel.BgpNeighbor) SetLocalPreference(org.batfish.datamodel.routing_policy.statement.SetLocalPreference) Table2(org.batfish.symbolic.collections.Table2) Prefix(org.batfish.datamodel.Prefix) SetOspfMetricType(org.batfish.datamodel.routing_policy.statement.SetOspfMetricType) AstVisitor(org.batfish.symbolic.AstVisitor) SetOspfMetricType(org.batfish.datamodel.routing_policy.statement.SetOspfMetricType) HashSet(java.util.HashSet)

Example 17 with If

use of org.batfish.datamodel.routing_policy.statement.If in project batfish by batfish.

the class TransferBDD method compute.

/*
   * Convert a list of statements into a Z3 boolean expression for the transfer function.
   */
private TransferResult<TransferReturn, BDD> compute(List<Statement> statements, TransferParam<BDDRoute> p) {
    boolean doesReturn = false;
    TransferResult<TransferReturn, BDD> result = new TransferResult<>();
    result = result.setReturnValue(new TransferReturn(p.getData(), factory.zero())).setFallthroughValue(factory.zero()).setReturnAssignedValue(factory.zero());
    for (Statement stmt : statements) {
        if (stmt instanceof StaticStatement) {
            StaticStatement ss = (StaticStatement) stmt;
            switch(ss.getType()) {
                case ExitAccept:
                    doesReturn = true;
                    p.debug("ExitAccept");
                    result = returnValue(result, true);
                    break;
                case ReturnTrue:
                    doesReturn = true;
                    p.debug("ReturnTrue");
                    result = returnValue(result, true);
                    break;
                case ExitReject:
                    doesReturn = true;
                    p.debug("ExitReject");
                    result = returnValue(result, false);
                    break;
                case ReturnFalse:
                    doesReturn = true;
                    p.debug("ReturnFalse");
                    result = returnValue(result, false);
                    break;
                case SetDefaultActionAccept:
                    p.debug("SetDefaulActionAccept");
                    p = p.setDefaultAccept(true);
                    break;
                case SetDefaultActionReject:
                    p.debug("SetDefaultActionReject");
                    p = p.setDefaultAccept(false);
                    break;
                case SetLocalDefaultActionAccept:
                    p.debug("SetLocalDefaultActionAccept");
                    p = p.setDefaultAcceptLocal(true);
                    break;
                case SetLocalDefaultActionReject:
                    p.debug("SetLocalDefaultActionReject");
                    p = p.setDefaultAcceptLocal(false);
                    break;
                case ReturnLocalDefaultAction:
                    p.debug("ReturnLocalDefaultAction");
                    // TODO: need to set local default action in an environment
                    if (p.getDefaultAcceptLocal()) {
                        result = returnValue(result, true);
                    } else {
                        result = returnValue(result, false);
                    }
                    break;
                case FallThrough:
                    p.debug("Fallthrough");
                    result = fallthrough(result);
                    break;
                case Return:
                    // TODO: assumming this happens at the end of the function, so it is ignored for now.
                    p.debug("Return");
                    break;
                case RemovePrivateAs:
                    p.debug("RemovePrivateAs");
                    // System.out.println("Warning: use of unimplemented feature RemovePrivateAs");
                    break;
                default:
                    throw new BatfishException("TODO: computeTransferFunction: " + ss.getType());
            }
        } else if (stmt instanceof If) {
            p.debug("If");
            If i = (If) stmt;
            TransferResult<TransferReturn, BDD> r = compute(i.getGuard(), p.indent());
            BDD guard = r.getReturnValue().getSecond();
            p.debug("guard: ");
            BDDRoute current = result.getReturnValue().getFirst();
            TransferParam<BDDRoute> pTrue = p.indent().setData(current.deepCopy());
            TransferParam<BDDRoute> pFalse = p.indent().setData(current.deepCopy());
            p.debug("True Branch");
            TransferResult<TransferReturn, BDD> trueBranch = compute(i.getTrueStatements(), pTrue);
            p.debug("True Branch: " + trueBranch.getReturnValue().getFirst().hashCode());
            p.debug("False Branch");
            TransferResult<TransferReturn, BDD> falseBranch = compute(i.getFalseStatements(), pFalse);
            p.debug("False Branch: " + trueBranch.getReturnValue().getFirst().hashCode());
            BDDRoute r1 = trueBranch.getReturnValue().getFirst();
            BDDRoute r2 = falseBranch.getReturnValue().getFirst();
            BDDRoute recordVal = ite(guard, r1, r2);
            // update return values
            BDD returnVal = ite(guard, trueBranch.getReturnValue().getSecond(), falseBranch.getReturnValue().getSecond());
            // p.debug("New Return Value (neg): " + returnVal.not());
            BDD returnAss = ite(guard, trueBranch.getReturnAssignedValue(), falseBranch.getReturnAssignedValue());
            // p.debug("New Return Assigned: " + returnAss);
            BDD fallThrough = ite(guard, trueBranch.getFallthroughValue(), falseBranch.getFallthroughValue());
            // p.debug("New fallthrough: " + fallThrough);
            result = result.setReturnValue(new TransferReturn(recordVal, returnVal)).setReturnAssignedValue(returnAss).setFallthroughValue(fallThrough);
            p.debug("If return: " + result.getReturnValue().getFirst().hashCode());
        } else if (stmt instanceof SetDefaultPolicy) {
            p.debug("SetDefaultPolicy");
            p = p.setDefaultPolicy((SetDefaultPolicy) stmt);
        } else if (stmt instanceof SetMetric) {
            p.debug("SetMetric");
            SetMetric sm = (SetMetric) stmt;
            LongExpr ie = sm.getMetric();
            BDD isBGP = p.getData().getProtocolHistory().value(Protocol.BGP);
            BDD updateMed = isBGP.and(result.getReturnAssignedValue());
            BDD updateMet = isBGP.not().and(result.getReturnAssignedValue());
            BDDInteger newValue = applyLongExprModification(p.indent(), p.getData().getMetric(), ie);
            BDDInteger med = ite(updateMed, p.getData().getMed(), newValue);
            BDDInteger met = ite(updateMet, p.getData().getMetric(), newValue);
            p.getData().setMetric(met);
            p.getData().setMetric(med);
        } else if (stmt instanceof SetOspfMetricType) {
            p.debug("SetOspfMetricType");
            SetOspfMetricType somt = (SetOspfMetricType) stmt;
            OspfMetricType mt = somt.getMetricType();
            BDDDomain<OspfType> current = result.getReturnValue().getFirst().getOspfMetric();
            BDDDomain<OspfType> newValue = new BDDDomain<>(current);
            if (mt == OspfMetricType.E1) {
                p.indent().debug("Value: E1");
                newValue.setValue(OspfType.E1);
            } else {
                p.indent().debug("Value: E2");
                newValue.setValue(OspfType.E1);
            }
            newValue = ite(result.getReturnAssignedValue(), p.getData().getOspfMetric(), newValue);
            p.getData().setOspfMetric(newValue);
        } else if (stmt instanceof SetLocalPreference) {
            p.debug("SetLocalPreference");
            SetLocalPreference slp = (SetLocalPreference) stmt;
            IntExpr ie = slp.getLocalPreference();
            BDDInteger newValue = applyIntExprModification(p.indent(), p.getData().getLocalPref(), ie);
            newValue = ite(result.getReturnAssignedValue(), p.getData().getLocalPref(), newValue);
            p.getData().setLocalPref(newValue);
        } else if (stmt instanceof AddCommunity) {
            p.debug("AddCommunity");
            AddCommunity ac = (AddCommunity) stmt;
            Set<CommunityVar> comms = _graph.findAllCommunities(_conf, ac.getExpr());
            for (CommunityVar cvar : comms) {
                if (!_policyQuotient.getCommsAssignedButNotMatched().contains(cvar)) {
                    p.indent().debug("Value: " + cvar);
                    BDD comm = p.getData().getCommunities().get(cvar);
                    BDD newValue = ite(result.getReturnAssignedValue(), comm, factory.one());
                    p.indent().debug("New Value: " + newValue);
                    p.getData().getCommunities().put(cvar, newValue);
                }
            }
        } else if (stmt instanceof SetCommunity) {
            p.debug("SetCommunity");
            SetCommunity sc = (SetCommunity) stmt;
            Set<CommunityVar> comms = _graph.findAllCommunities(_conf, sc.getExpr());
            for (CommunityVar cvar : comms) {
                if (!_policyQuotient.getCommsAssignedButNotMatched().contains(cvar)) {
                    p.indent().debug("Value: " + cvar);
                    BDD comm = p.getData().getCommunities().get(cvar);
                    BDD newValue = ite(result.getReturnAssignedValue(), comm, factory.one());
                    p.indent().debug("New Value: " + newValue);
                    p.getData().getCommunities().put(cvar, newValue);
                }
            }
        } else if (stmt instanceof DeleteCommunity) {
            p.debug("DeleteCommunity");
            DeleteCommunity ac = (DeleteCommunity) stmt;
            Set<CommunityVar> comms = _graph.findAllCommunities(_conf, ac.getExpr());
            Set<CommunityVar> toDelete = new HashSet<>();
            // Find comms to delete
            for (CommunityVar cvar : comms) {
                if (cvar.getType() == Type.REGEX) {
                    toDelete.addAll(_commDeps.get(cvar));
                } else {
                    toDelete.add(cvar);
                }
            }
            // Delete the comms
            for (CommunityVar cvar : toDelete) {
                if (!_policyQuotient.getCommsAssignedButNotMatched().contains(cvar)) {
                    p.indent().debug("Value: " + cvar.getValue() + ", " + cvar.getType());
                    BDD comm = p.getData().getCommunities().get(cvar);
                    BDD newValue = ite(result.getReturnAssignedValue(), comm, factory.zero());
                    p.indent().debug("New Value: " + newValue);
                    p.getData().getCommunities().put(cvar, newValue);
                }
            }
        } else if (stmt instanceof RetainCommunity) {
            p.debug("RetainCommunity");
        // no op
        } else if (stmt instanceof PrependAsPath) {
            p.debug("PrependAsPath");
            PrependAsPath pap = (PrependAsPath) stmt;
            Integer prependCost = prependLength(pap.getExpr());
            p.indent().debug("Cost: " + prependCost);
            BDDInteger met = p.getData().getMetric();
            BDDInteger newValue = met.add(BDDInteger.makeFromValue(met.getFactory(), 32, prependCost));
            newValue = ite(result.getReturnAssignedValue(), p.getData().getMetric(), newValue);
            p.getData().setMetric(newValue);
        } else if (stmt instanceof SetOrigin) {
            p.debug("SetOrigin");
        // System.out.println("Warning: use of unimplemented feature SetOrigin");
        // TODO: implement me
        } else if (stmt instanceof SetNextHop) {
            p.debug("SetNextHop");
        // System.out.println("Warning: use of unimplemented feature SetNextHop");
        // TODO: implement me
        } else {
            throw new BatfishException("TODO: statement transfer function: " + stmt);
        }
    }
    // If this is the outermost call, then we relate the variables
    if (p.getInitialCall()) {
        p.debug("InitialCall finalizing");
        // Apply the default action
        if (!doesReturn) {
            p.debug("Applying default action: " + p.getDefaultAccept());
            if (p.getDefaultAccept()) {
                result = returnValue(result, true);
            } else {
                result = returnValue(result, false);
            }
        }
        // Set all the values to 0 if the return is not true;
        TransferReturn ret = result.getReturnValue();
        BDDRoute retVal = ite(ret.getSecond(), ret.getFirst(), zeroedRecord());
        result = result.setReturnValue(new TransferReturn(retVal, ret.getSecond()));
    }
    return result;
}
Also used : BDD(net.sf.javabdd.BDD) MatchCommunitySet(org.batfish.datamodel.routing_policy.expr.MatchCommunitySet) MatchPrefix6Set(org.batfish.datamodel.routing_policy.expr.MatchPrefix6Set) InlineCommunitySet(org.batfish.datamodel.routing_policy.expr.InlineCommunitySet) Set(java.util.Set) NamedPrefixSet(org.batfish.datamodel.routing_policy.expr.NamedPrefixSet) HashSet(java.util.HashSet) ExplicitPrefixSet(org.batfish.datamodel.routing_policy.expr.ExplicitPrefixSet) MatchPrefixSet(org.batfish.datamodel.routing_policy.expr.MatchPrefixSet) NamedCommunitySet(org.batfish.datamodel.routing_policy.expr.NamedCommunitySet) TransferResult(org.batfish.symbolic.TransferResult) RetainCommunity(org.batfish.datamodel.routing_policy.statement.RetainCommunity) SetMetric(org.batfish.datamodel.routing_policy.statement.SetMetric) SetCommunity(org.batfish.datamodel.routing_policy.statement.SetCommunity) OspfType(org.batfish.symbolic.OspfType) SetNextHop(org.batfish.datamodel.routing_policy.statement.SetNextHop) LongExpr(org.batfish.datamodel.routing_policy.expr.LongExpr) HashSet(java.util.HashSet) BatfishException(org.batfish.common.BatfishException) StaticStatement(org.batfish.datamodel.routing_policy.statement.Statements.StaticStatement) Statement(org.batfish.datamodel.routing_policy.statement.Statement) StaticStatement(org.batfish.datamodel.routing_policy.statement.Statements.StaticStatement) SetOrigin(org.batfish.datamodel.routing_policy.statement.SetOrigin) DeleteCommunity(org.batfish.datamodel.routing_policy.statement.DeleteCommunity) SetDefaultPolicy(org.batfish.datamodel.routing_policy.statement.SetDefaultPolicy) AddCommunity(org.batfish.datamodel.routing_policy.statement.AddCommunity) CommunityVar(org.batfish.symbolic.CommunityVar) OspfMetricType(org.batfish.datamodel.OspfMetricType) SetOspfMetricType(org.batfish.datamodel.routing_policy.statement.SetOspfMetricType) SetLocalPreference(org.batfish.datamodel.routing_policy.statement.SetLocalPreference) TransferParam(org.batfish.symbolic.TransferParam) PrependAsPath(org.batfish.datamodel.routing_policy.statement.PrependAsPath) SetOspfMetricType(org.batfish.datamodel.routing_policy.statement.SetOspfMetricType) IntExpr(org.batfish.datamodel.routing_policy.expr.IntExpr) If(org.batfish.datamodel.routing_policy.statement.If)

Example 18 with If

use of org.batfish.datamodel.routing_policy.statement.If in project batfish by batfish.

the class BatfishCompressionTest method assertIsCompressedConfig.

private static void assertIsCompressedConfig(Configuration config) {
    config.getRoutingPolicies().values().forEach(p -> {
        assertEquals(p.getStatements().size(), 1);
        assertThat(p.getStatements().get(0), instanceOf(If.class));
        If i = (If) p.getStatements().get(0);
        assertNotNull(i.getGuard());
    });
}
Also used : If(org.batfish.datamodel.routing_policy.statement.If)

Example 19 with If

use of org.batfish.datamodel.routing_policy.statement.If in project batfish by batfish.

the class BatfishCompressionTest method testCompressionFibs_diamondNetwork.

/**
 * Test the following invariant: if a FIB appears on concrete router “r”, then a corresponding
 * abstract FIB appears on one of these representatives. For example, if there is a concrete FIB
 * from C to D, then there should be an abstract FIB from A to B, where A is in representatives(C)
 * and B is in representatives(D).
 */
@Test
public void testCompressionFibs_diamondNetwork() throws IOException {
    IpAccessListLine line = new IpAccessListLine();
    line.setDstIps(ImmutableList.of(new IpWildcard(Prefix.parse("4.4.4.4/32"))));
    SortedMap<String, Configuration> origConfigs = diamondNetwork();
    DataPlane origDataPlane = getDataPlane(origConfigs);
    Map<String, Map<String, Fib>> origFibs = origDataPlane.getFibs();
    Topology origTopology = new Topology(origDataPlane.getTopologyEdges());
    /* Node A should have a route with C as a next hop. */
    assertThat(origFibs, hasEntry(equalTo("A"), hasEntry(equalTo(Configuration.DEFAULT_VRF_NAME), hasNextHopInterfaces(hasValue(hasKey(withNode("A", isNeighborOfNode(origTopology, "C"))))))));
    // compress a new copy since it will get mutated.
    SortedMap<String, Configuration> compressedConfigs = new TreeMap<>(compressNetwork(diamondNetwork(), line));
    DataPlane compressedDataPlane = getDataPlane(compressedConfigs);
    compressedConfigs.values().forEach(BatfishCompressionTest::assertIsCompressedConfig);
    assertThat(compressedConfigs.values(), hasSize(3));
    SortedMap<String, SortedMap<String, GenericRib<AbstractRoute>>> origRibs = origDataPlane.getRibs();
    SortedMap<String, SortedMap<String, GenericRib<AbstractRoute>>> compressedRibs = compressedDataPlane.getRibs();
    compressedRibs.forEach((hostname, compressedRibsByVrf) -> compressedRibsByVrf.forEach((vrf, compressedRib) -> {
        GenericRib<AbstractRoute> origRib = origRibs.get(hostname).get(vrf);
        Set<AbstractRoute> origRoutes = origRib.getRoutes();
        Set<AbstractRoute> compressedRoutes = compressedRib.getRoutes();
        for (AbstractRoute route : compressedRoutes) {
            /* Every compressed route should appear in original RIB */
            assertThat(origRoutes, hasItem(route));
        }
    }));
    /* Compression removed B or C entirely (but not both) */
    assertThat(compressedRibs, either(not(hasKey("B"))).or(not(hasKey("C"))));
    assertThat(compressedRibs, either(hasKey("B")).or(hasKey("C")));
    String remains = compressedConfigs.containsKey("B") ? "B" : "C";
    /* The remaining node is unchanged. */
    assertThat(origRibs.get(remains).get(Configuration.DEFAULT_VRF_NAME).getRoutes(), equalTo(compressedRibs.get(remains).get(Configuration.DEFAULT_VRF_NAME).getRoutes()));
}
Also used : DataPlane(org.batfish.datamodel.DataPlane) AbstractRoute(org.batfish.datamodel.AbstractRoute) BatfishTestUtils(org.batfish.main.BatfishTestUtils) FibMatchers.hasNextHopInterfaces(org.batfish.datamodel.matchers.FibMatchers.hasNextHopInterfaces) BdpDataPlanePlugin(org.batfish.bdp.BdpDataPlanePlugin) HeaderSpace(org.batfish.datamodel.HeaderSpace) Matchers.either(org.hamcrest.Matchers.either) If(org.batfish.datamodel.routing_policy.statement.If) TopologyMatchers.isNeighborOfNode(org.batfish.datamodel.matchers.TopologyMatchers.isNeighborOfNode) Matchers.not(org.hamcrest.Matchers.not) InterfaceAddress(org.batfish.datamodel.InterfaceAddress) Matchers.hasValue(org.hamcrest.Matchers.hasValue) Matchers.hasKey(org.hamcrest.Matchers.hasKey) Interface(org.batfish.datamodel.Interface) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) TestCase.assertNotNull(junit.framework.TestCase.assertNotNull) ImmutableList(com.google.common.collect.ImmutableList) AbstractRoute(org.batfish.datamodel.AbstractRoute) Topology(org.batfish.datamodel.Topology) TopologyMatchers.withNode(org.batfish.datamodel.matchers.TopologyMatchers.withNode) Map(java.util.Map) Configuration(org.batfish.datamodel.Configuration) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Batfish(org.batfish.main.Batfish) Vrf(org.batfish.datamodel.Vrf) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) Matchers.hasEntry(org.hamcrest.Matchers.hasEntry) ConfigurationFormat(org.batfish.datamodel.ConfigurationFormat) DataPlane(org.batfish.datamodel.DataPlane) NetworkFactory(org.batfish.datamodel.NetworkFactory) StaticRoute(org.batfish.datamodel.StaticRoute) Fib(org.batfish.datamodel.Fib) Set(java.util.Set) GenericRib(org.batfish.datamodel.GenericRib) IOException(java.io.IOException) Test(org.junit.Test) IBatfish(org.batfish.common.plugin.IBatfish) Matchers.hasItem(org.hamcrest.Matchers.hasItem) TreeMap(java.util.TreeMap) IpAccessListLine(org.batfish.datamodel.IpAccessListLine) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Assert.assertEquals(org.junit.Assert.assertEquals) SortedMap(java.util.SortedMap) IpWildcard(org.batfish.datamodel.IpWildcard) TemporaryFolder(org.junit.rules.TemporaryFolder) Prefix(org.batfish.datamodel.Prefix) Set(java.util.Set) Configuration(org.batfish.datamodel.Configuration) GenericRib(org.batfish.datamodel.GenericRib) Topology(org.batfish.datamodel.Topology) TreeMap(java.util.TreeMap) IpWildcard(org.batfish.datamodel.IpWildcard) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) SortedMap(java.util.SortedMap) IpAccessListLine(org.batfish.datamodel.IpAccessListLine) Map(java.util.Map) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) TreeMap(java.util.TreeMap) SortedMap(java.util.SortedMap) Test(org.junit.Test)

Example 20 with If

use of org.batfish.datamodel.routing_policy.statement.If in project batfish by batfish.

the class RoutingPolicyTests method testRoutingPolicyCircularReferenceExpr.

/**
 * Policy with actual circular reference as expr
 */
@Test
public void testRoutingPolicyCircularReferenceExpr() {
    String parentPolicyName = "parent";
    CallExpr callExpr = new CallExpr(parentPolicyName);
    If ifStatement = new If();
    ifStatement.setGuard(callExpr);
    _rpb.setName(parentPolicyName).setStatements(ImmutableList.of(ifStatement)).build();
    _c.computeRoutingPolicySources(_w);
    /*
     * A circular reference warning should be emitted containing the name of the circularly
     * referenced policy.
     */
    assertThat(_w.getRedFlagWarnings(), not(empty()));
    assertThat(_w.getRedFlagWarnings().iterator().next().getText(), containsString(parentPolicyName));
}
Also used : CallExpr(org.batfish.datamodel.routing_policy.expr.CallExpr) Matchers.containsString(org.hamcrest.Matchers.containsString) If(org.batfish.datamodel.routing_policy.statement.If) Test(org.junit.Test)

Aggregations

If (org.batfish.datamodel.routing_policy.statement.If)35 RoutingPolicy (org.batfish.datamodel.routing_policy.RoutingPolicy)22 Statement (org.batfish.datamodel.routing_policy.statement.Statement)20 Prefix (org.batfish.datamodel.Prefix)14 CallExpr (org.batfish.datamodel.routing_policy.expr.CallExpr)13 BooleanExpr (org.batfish.datamodel.routing_policy.expr.BooleanExpr)12 Disjunction (org.batfish.datamodel.routing_policy.expr.Disjunction)12 ArrayList (java.util.ArrayList)11 Conjunction (org.batfish.datamodel.routing_policy.expr.Conjunction)11 MatchPrefixSet (org.batfish.datamodel.routing_policy.expr.MatchPrefixSet)11 BatfishException (org.batfish.common.BatfishException)10 MatchProtocol (org.batfish.datamodel.routing_policy.expr.MatchProtocol)10 HashMap (java.util.HashMap)9 Map (java.util.Map)9 DestinationNetwork (org.batfish.datamodel.routing_policy.expr.DestinationNetwork)9 SetOspfMetricType (org.batfish.datamodel.routing_policy.statement.SetOspfMetricType)9 Set (java.util.Set)8 BgpNeighbor (org.batfish.datamodel.BgpNeighbor)8 Configuration (org.batfish.datamodel.Configuration)8 GeneratedRoute (org.batfish.datamodel.GeneratedRoute)8