Search in sources :

Example 1 with NamedPrefix6Set

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

the class PsFromRouteFilter method toBooleanExpr.

@Override
public BooleanExpr toBooleanExpr(JuniperConfiguration jc, Configuration c, Warnings warnings) {
    RouteFilterList rfl = c.getRouteFilterLists().get(_routeFilterName);
    Route6FilterList rfl6 = c.getRoute6FilterLists().get(_routeFilterName);
    BooleanExpr match4 = null;
    BooleanExpr match6 = null;
    if (rfl != null) {
        match4 = new MatchPrefixSet(new DestinationNetwork(), new NamedPrefixSet(_routeFilterName));
    }
    if (rfl6 != null) {
        match6 = new MatchPrefix6Set(new DestinationNetwork6(), new NamedPrefix6Set(_routeFilterName));
    }
    if (match4 != null && match6 == null) {
        return match4;
    } else if (rfl == null && rfl6 != null) {
        return match6;
    } else if (rfl != null && rfl6 != null) {
        Disjunction d = new Disjunction();
        d.getDisjuncts().add(match4);
        d.getDisjuncts().add(match6);
        return d;
    } else {
        throw new VendorConversionException("missing route filter list: \"" + _routeFilterName + "\"");
    }
}
Also used : MatchPrefix6Set(org.batfish.datamodel.routing_policy.expr.MatchPrefix6Set) VendorConversionException(org.batfish.common.VendorConversionException) Disjunction(org.batfish.datamodel.routing_policy.expr.Disjunction) DestinationNetwork(org.batfish.datamodel.routing_policy.expr.DestinationNetwork) RouteFilterList(org.batfish.datamodel.RouteFilterList) NamedPrefixSet(org.batfish.datamodel.routing_policy.expr.NamedPrefixSet) MatchPrefixSet(org.batfish.datamodel.routing_policy.expr.MatchPrefixSet) Route6FilterList(org.batfish.datamodel.Route6FilterList) 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 2 with NamedPrefix6Set

use of org.batfish.datamodel.routing_policy.expr.NamedPrefix6Set 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 3 with NamedPrefix6Set

use of org.batfish.datamodel.routing_policy.expr.NamedPrefix6Set 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)

Aggregations

BooleanExpr (org.batfish.datamodel.routing_policy.expr.BooleanExpr)3 DestinationNetwork6 (org.batfish.datamodel.routing_policy.expr.DestinationNetwork6)3 Disjunction (org.batfish.datamodel.routing_policy.expr.Disjunction)3 MatchPrefix6Set (org.batfish.datamodel.routing_policy.expr.MatchPrefix6Set)3 NamedPrefix6Set (org.batfish.datamodel.routing_policy.expr.NamedPrefix6Set)3 Route6FilterList (org.batfish.datamodel.Route6FilterList)2 VendorConversionException (org.batfish.common.VendorConversionException)1 Ip6AccessList (org.batfish.datamodel.Ip6AccessList)1 RouteFilterList (org.batfish.datamodel.RouteFilterList)1 DestinationNetwork (org.batfish.datamodel.routing_policy.expr.DestinationNetwork)1 MatchIp6AccessList (org.batfish.datamodel.routing_policy.expr.MatchIp6AccessList)1 MatchPrefixSet (org.batfish.datamodel.routing_policy.expr.MatchPrefixSet)1 NamedPrefixSet (org.batfish.datamodel.routing_policy.expr.NamedPrefixSet)1