use of org.onosproject.security.AppPermission.Type.DRIVER_READ in project onos by opennetworkinglab.
the class DriverRegistryManager method getDriver.
@Override
public Driver getDriver(String mfr, String hw, String sw) {
checkPermission(DRIVER_READ);
// First attempt a literal search.
Driver driver = driverByKey.get(key(mfr, hw, sw));
if (driver != null) {
return driver;
}
// Otherwise, sweep through the key space and attempt to match using
// regular expression matching.
Optional<Driver> optional = driverByKey.values().stream().filter(d -> matches(d, mfr, hw, sw)).findFirst();
// If no matching driver is found, return default.
return optional.orElse(drivers.get(DEFAULT));
}
Aggregations