@Override public BooleanExpr toBooleanExpr(CiscoConfiguration cc, Configuration c, Warnings w) { MatchAsPath match = new MatchAsPath(new ExplicitAsPathSet(Collections.emptyList())); return match; } }
@Override public BooleanExpr toBooleanExpr(CiscoConfiguration cc, Configuration c, Warnings w) { if (_asExpr instanceof NamedAsPathSet) { NamedAsPathSet named = (NamedAsPathSet) _asExpr; String name = named.getName(); AsPathSet asPathSet = cc.getAsPathSets().get(name); if (asPathSet == null) { // Undefined, return false. return BooleanExprs.FALSE; } } MatchAsPath match = new MatchAsPath(_asExpr); return match; } }
@Override public BooleanExpr toBooleanExpr(JuniperConfiguration jc, Configuration c, Warnings warnings) { return new MatchAsPath(new NamedAsPathSet(_asPathName)); } }
@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) { disjuncts.add(new MatchAsPath(new NamedAsPathSet(listName))); } } return d.simplify(); } }
/** * Create a filter that only allows traffic for those prefixes if it came from outside. EXTERNAL = * (protocol is bgp or ibgp) and (the AS path is not an internal path) MATCH = destination matches * the prefixTrie GUARD = EXTERNAL or MATCH (only allow this traffic through) */ @Nonnull private BooleanExpr matchExternalTraffic() { List<AsPathSetElem> elements = new ArrayList<>(); elements.add(new RegexAsPathSetElem(_internalRegex)); ExplicitAsPathSet expr = new ExplicitAsPathSet(elements); MatchAsPath matchPath = new MatchAsPath(expr); MatchProtocol mpBgp = new MatchProtocol(RoutingProtocol.BGP); MatchProtocol mpIbgp = new MatchProtocol(RoutingProtocol.IBGP); Disjunction d = new Disjunction(); List<BooleanExpr> disjuncts = new ArrayList<>(); disjuncts.add(mpBgp); disjuncts.add(mpIbgp); d.setDisjuncts(disjuncts); Not n = new Not(matchPath); Conjunction c = new Conjunction(); List<BooleanExpr> conjuncts = new ArrayList<>(); conjuncts.add(d); conjuncts.add(n); c.setConjuncts(conjuncts); return c; }