@Override public IpSpaceAssignment resolve(Set<Location> key, SpecifierContext ctxt) { Set<Location> locations = _locationSpecifier.resolve(ctxt); checkArgument(!locations.isEmpty(), "No such locations"); IpSpace ipSpace = AclIpSpace.union( InferFromLocationIpSpaceSpecifier.INSTANCE.resolve(locations, ctxt).getEntries() .stream() .map(Entry::getIpSpace) .collect(Collectors.toList())); return IpSpaceAssignment.builder() .assign(key, firstNonNull(ipSpace, EmptyIpSpace.INSTANCE)) .build(); } }
@Override public IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt) { AddressGroup addressGroup = ctxt.getReferenceBook(_bookName) .orElseThrow( () -> new NoSuchElementException("ReferenceBook '" + _bookName + "' not found")) .getAddressGroup(_addressGroupName) .orElseThrow( () -> new NoSuchElementException( "AddressGroup '" + _addressGroupName + "' not found in ReferenceBook '" + _bookName + "'")); return IpSpaceAssignment.builder() .assign( locations, firstNonNull( AclIpSpace.union( addressGroup.getAddresses().stream() .map(add -> new IpWildcard(add).toIpSpace()) .collect(Collectors.toList())), EmptyIpSpace.INSTANCE)) .build(); } }
@Override public IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt) { IpSpaceLocationVisitor ipSpaceLocationVisitor = new IpSpaceLocationVisitor(ctxt); IpSpaceAssignment.Builder builder = IpSpaceAssignment.builder(); locations.forEach( location -> builder.assign(location, location.accept(ipSpaceLocationVisitor))); return builder.build(); } }
@Override public IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt) { return IpSpaceAssignment.builder().assign(locations, _ipSpace).build(); }