@JsonCreator private static NamedPrefixSet create(@Nullable @JsonProperty(PROP_NAME) String name) { checkArgument(name != null, "%s must be provided", PROP_NAME); return new NamedPrefixSet(name); }
@Nullable @Override public PrefixSetExpr toPrefixSetExpr(CiscoConfiguration cc, Configuration c, Warnings w) { if (cc.getPrefix6Lists().containsKey(_name)) { return null; } return new NamedPrefixSet(_name); } }
@Override public BooleanExpr toBooleanExpr(JuniperConfiguration jc, Configuration c, Warnings warnings) { return new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(_name)); } }
@Override public BooleanExpr toBooleanExpr(VyosConfiguration vc, Configuration c, Warnings w) { PrefixList pl = vc.getPrefixLists().get(_prefixList); if (pl != null) { return new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(_prefixList)); } else { vc.undefined( VyosStructureType.PREFIX_LIST, _prefixList, VyosStructureUsage.ROUTE_MAP_MATCH_PREFIX_LIST, _statementLine); // TODO: see if vyos treats as true, false, or disallows return BooleanExprs.TRUE; } } }
@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) { disjuncts.add( new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(listName))); } } return d.simplify(); } }
"Suppress more specific networks for summary-only aggregate-address networks", new MatchPrefixSet( DestinationNetwork.instance(), new NamedPrefixSet(matchLonger.getName())), ImmutableList.of(Statements.Suppress.toStaticStatement()), ImmutableList.of());
@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; IpAccessList ipAccessList = null; RouteFilterList routeFilterList = null; if (_routing) { routeFilterList = c.getRouteFilterLists().get(listName); list = routeFilterList; } else { ipAccessList = c.getIpAccessLists().get(listName); list = ipAccessList; } if (list != null) { if (_routing) { disjuncts.add( new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(listName))); } else { disjuncts.add(new MatchIpAccessList(listName)); } } } return d.simplify(); } }
@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(DestinationNetwork.instance(), 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 + "\""); } } }
@Override public BooleanExpr toBooleanExpr(JuniperConfiguration jc, Configuration c, Warnings warnings) { PrefixList pl = jc.getMasterLogicalSystem().getPrefixLists().get(_prefixList); if (pl != null) { if (pl.getIpv6()) { return BooleanExprs.FALSE; } RouteFilterList rf = c.getRouteFilterLists().get(_prefixList); String orLongerListName = "~" + _prefixList + "~ORLONGER~"; RouteFilterList orLongerList = c.getRouteFilterLists().get(orLongerListName); if (orLongerList == null) { orLongerList = new RouteFilterList(orLongerListName); for (RouteFilterLine line : rf.getLines()) { Prefix prefix = line.getIpWildcard().toPrefix(); LineAction action = line.getAction(); SubRange orLongerLineRange = new SubRange(line.getLengthRange().getStart(), Prefix.MAX_PREFIX_LENGTH); RouteFilterLine orLongerLine = new RouteFilterLine(action, prefix, orLongerLineRange); orLongerList.addLine(orLongerLine); c.getRouteFilterLists().put(orLongerListName, orLongerList); } } return new MatchPrefixSet( DestinationNetwork.instance(), new NamedPrefixSet(orLongerListName)); } else { warnings.redFlag("Reference to undefined prefix-list: \"" + _prefixList + "\""); return BooleanExprs.FALSE; } } }
new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(rflName)); RouteFilterList rfList = new RouteFilterList(rflName); rfList.addLine(
return new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(longerListName)); } else { warnings.redFlag("Reference to undefined prefix-list: \"" + _prefixList + "\"");
String rflName = "~SUMMARY" + policyNameSuffix + "_RF~"; MatchPrefixSet isContributingRoute = new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(rflName)); routingPolicyConditional.setGuard(isContributingRoute); RouteFilterList rfList = new RouteFilterList(rflName);
MatchPrefixSet mrf = new MatchPrefixSet( DestinationNetwork.instance(), new NamedPrefixSet(lineListName)); lineSpecificIfStatement.setGuard(mrf); lineSpecificIfStatement.getTrueStatements().addAll(toStatements(line.getThens()));
.add( new MatchPrefixSet( DestinationNetwork.instance(), new NamedPrefixSet(originationPolicyName)));