Search in sources :

Example 16 with Disjunction

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

the class RouteMapMatchIpPrefixListLine method toBooleanExpr.

@Override
public BooleanExpr toBooleanExpr(Configuration c, CiscoConfiguration cc, Warnings w) {
    Disjunction d = new Disjunction();
    List<BooleanExpr> disjuncts = d.getDisjuncts();
    for (String listName : _listNames) {
        PrefixList list = cc.getPrefixLists().get(listName);
        if (list != null) {
            list.getReferers().put(this, "route-map match prefix-list");
            disjuncts.add(new MatchPrefixSet(new DestinationNetwork(), new NamedPrefixSet(listName)));
        } else {
            cc.undefined(CiscoStructureType.PREFIX_LIST, listName, CiscoStructureUsage.ROUTE_MAP_MATCH_IP_PREFIX_LIST, _statementLine);
        }
    }
    return d.simplify();
}
Also used : Disjunction(org.batfish.datamodel.routing_policy.expr.Disjunction) DestinationNetwork(org.batfish.datamodel.routing_policy.expr.DestinationNetwork) NamedPrefixSet(org.batfish.datamodel.routing_policy.expr.NamedPrefixSet) MatchPrefixSet(org.batfish.datamodel.routing_policy.expr.MatchPrefixSet) BooleanExpr(org.batfish.datamodel.routing_policy.expr.BooleanExpr)

Example 17 with Disjunction

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

the class RouteMapMatchIpv6AccessListLine method toBooleanExpr.

@Override
public BooleanExpr toBooleanExpr(Configuration c, CiscoConfiguration cc, Warnings w) {
    Disjunction d = new Disjunction();
    List<BooleanExpr> disjuncts = d.getDisjuncts();
    for (String listName : _listNames) {
        Object list;
        Ip6AccessList ipAccessList = null;
        Route6FilterList routeFilterList = null;
        if (_routing) {
            routeFilterList = c.getRoute6FilterLists().get(listName);
            list = routeFilterList;
        } else {
            ipAccessList = c.getIp6AccessLists().get(listName);
            list = ipAccessList;
        }
        if (list == null) {
            cc.undefined(CiscoStructureType.IPV6_ACCESS_LIST, listName, CiscoStructureUsage.ROUTE_MAP_MATCH_IPV6_ACCESS_LIST, _statementLine);
        } else {
            String msg = "route-map match ipv6 access-list line";
            ExtendedIpv6AccessList extendedAccessList = cc.getExtendedIpv6Acls().get(listName);
            if (extendedAccessList != null) {
                extendedAccessList.getReferers().put(this, msg);
            }
            StandardIpv6AccessList standardAccessList = cc.getStandardIpv6Acls().get(listName);
            if (standardAccessList != null) {
                standardAccessList.getReferers().put(this, msg);
            }
            if (_routing) {
                disjuncts.add(new MatchPrefix6Set(new DestinationNetwork6(), new NamedPrefix6Set(listName)));
            } else {
                disjuncts.add(new MatchIp6AccessList(listName));
            }
        }
    }
    return d.simplify();
}
Also used : MatchPrefix6Set(org.batfish.datamodel.routing_policy.expr.MatchPrefix6Set) Route6FilterList(org.batfish.datamodel.Route6FilterList) NamedPrefix6Set(org.batfish.datamodel.routing_policy.expr.NamedPrefix6Set) DestinationNetwork6(org.batfish.datamodel.routing_policy.expr.DestinationNetwork6) Disjunction(org.batfish.datamodel.routing_policy.expr.Disjunction) MatchIp6AccessList(org.batfish.datamodel.routing_policy.expr.MatchIp6AccessList) BooleanExpr(org.batfish.datamodel.routing_policy.expr.BooleanExpr) Ip6AccessList(org.batfish.datamodel.Ip6AccessList) MatchIp6AccessList(org.batfish.datamodel.routing_policy.expr.MatchIp6AccessList)

Example 18 with Disjunction

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

the class RouteMapMatchIpv6PrefixListLine method toBooleanExpr.

@Override
public BooleanExpr toBooleanExpr(Configuration c, CiscoConfiguration cc, Warnings w) {
    Disjunction d = new Disjunction();
    List<BooleanExpr> disjuncts = d.getDisjuncts();
    for (String listName : _listNames) {
        Prefix6List list = cc.getPrefix6Lists().get(listName);
        if (list != null) {
            list.getReferers().put(this, "route-map match prefix-list");
            disjuncts.add(new MatchPrefix6Set(new DestinationNetwork6(), new NamedPrefix6Set(listName)));
        } else {
            cc.undefined(CiscoStructureType.PREFIX6_LIST, listName, CiscoStructureUsage.ROUTE_MAP_MATCH_IPV6_PREFIX_LIST, _statementLine);
        }
    }
    return d.simplify();
}
Also used : MatchPrefix6Set(org.batfish.datamodel.routing_policy.expr.MatchPrefix6Set) Disjunction(org.batfish.datamodel.routing_policy.expr.Disjunction) NamedPrefix6Set(org.batfish.datamodel.routing_policy.expr.NamedPrefix6Set) BooleanExpr(org.batfish.datamodel.routing_policy.expr.BooleanExpr) DestinationNetwork6(org.batfish.datamodel.routing_policy.expr.DestinationNetwork6)

Example 19 with Disjunction

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

the class RouteMapMatchProtocolLine method toBooleanExpr.

@Override
public BooleanExpr toBooleanExpr(Configuration c, CiscoConfiguration cc, Warnings w) {
    Disjunction d = new Disjunction();
    List<BooleanExpr> disjuncts = d.getDisjuncts();
    for (String protocol : _protocols) {
        disjuncts.add(new MatchProtocol(RoutingProtocol.fromProtocolName(protocol)));
    }
    return d.simplify();
}
Also used : Disjunction(org.batfish.datamodel.routing_policy.expr.Disjunction) BooleanExpr(org.batfish.datamodel.routing_policy.expr.BooleanExpr) MatchProtocol(org.batfish.datamodel.routing_policy.expr.MatchProtocol)

Example 20 with Disjunction

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

the class RouteMapMatchAsPathAccessListLine method toBooleanExpr.

@Override
public BooleanExpr toBooleanExpr(Configuration c, CiscoConfiguration cc, Warnings w) {
    Disjunction d = new Disjunction();
    List<BooleanExpr> disjuncts = d.getDisjuncts();
    for (String listName : _listNames) {
        IpAsPathAccessList list = cc.getAsPathAccessLists().get(listName);
        if (list != null) {
            list.getReferers().put(this, "route-map match ip as-path access-list");
            disjuncts.add(new MatchAsPath(new NamedAsPathSet(listName)));
        } else {
            cc.undefined(CiscoStructureType.AS_PATH_ACCESS_LIST, listName, CiscoStructureUsage.ROUTE_MAP_MATCH_AS_PATH_ACCESS_LIST, _statementLine);
        }
    }
    return d.simplify();
}
Also used : Disjunction(org.batfish.datamodel.routing_policy.expr.Disjunction) NamedAsPathSet(org.batfish.datamodel.routing_policy.expr.NamedAsPathSet) MatchAsPath(org.batfish.datamodel.routing_policy.expr.MatchAsPath) BooleanExpr(org.batfish.datamodel.routing_policy.expr.BooleanExpr)

Aggregations

Disjunction (org.batfish.datamodel.routing_policy.expr.Disjunction)24 BooleanExpr (org.batfish.datamodel.routing_policy.expr.BooleanExpr)18 RoutingPolicy (org.batfish.datamodel.routing_policy.RoutingPolicy)10 If (org.batfish.datamodel.routing_policy.statement.If)10 Conjunction (org.batfish.datamodel.routing_policy.expr.Conjunction)8 MatchProtocol (org.batfish.datamodel.routing_policy.expr.MatchProtocol)8 CallExpr (org.batfish.datamodel.routing_policy.expr.CallExpr)7 MatchPrefixSet (org.batfish.datamodel.routing_policy.expr.MatchPrefixSet)7 ArrayList (java.util.ArrayList)6 MatchPrefix6Set (org.batfish.datamodel.routing_policy.expr.MatchPrefix6Set)6 Not (org.batfish.datamodel.routing_policy.expr.Not)6 DestinationNetwork (org.batfish.datamodel.routing_policy.expr.DestinationNetwork)5 DisjunctionChain (org.batfish.datamodel.routing_policy.expr.DisjunctionChain)5 BatfishException (org.batfish.common.BatfishException)4 ConjunctionChain (org.batfish.datamodel.routing_policy.expr.ConjunctionChain)4 DestinationNetwork6 (org.batfish.datamodel.routing_policy.expr.DestinationNetwork6)4 MatchAsPath (org.batfish.datamodel.routing_policy.expr.MatchAsPath)4 NamedPrefixSet (org.batfish.datamodel.routing_policy.expr.NamedPrefixSet)4 Statement (org.batfish.datamodel.routing_policy.statement.Statement)4 BigInteger (java.math.BigInteger)3