use of org.onlab.util.ItemNotFoundException in project onos by opennetworkinglab.
the class ResourceDeviceListener method queryVlanIds.
private Set<VlanId> queryVlanIds(DeviceId device, PortNumber port) {
try {
DriverHandler handler = driverService.createHandler(device);
if (handler == null || !handler.hasBehaviour(VlanQuery.class)) {
return ImmutableSet.of();
}
VlanQuery query = handler.behaviour(VlanQuery.class);
if (query == null) {
return ImmutableSet.of();
}
return query.queryVlanIds(port);
} catch (ItemNotFoundException e) {
return ImmutableSet.of();
}
}
use of org.onlab.util.ItemNotFoundException in project onos by opennetworkinglab.
the class ResourceDeviceListener method queryTributarySlots.
private Set<TributarySlot> queryTributarySlots(DeviceId device, PortNumber port) {
try {
DriverHandler handler = driverService.createHandler(device);
if (handler == null || !handler.hasBehaviour(TributarySlotQuery.class)) {
return Collections.emptySet();
}
TributarySlotQuery query = handler.behaviour(TributarySlotQuery.class);
if (query != null) {
return query.queryTributarySlots(port);
} else {
return Collections.emptySet();
}
} catch (ItemNotFoundException e) {
return Collections.emptySet();
}
}
use of org.onlab.util.ItemNotFoundException in project onos by opennetworkinglab.
the class FlowObjectiveManager method initPipelineHandler.
/**
* Creates and initialize {@link Pipeliner}.
* <p>
* Note: Expected to be called under per-Device lock.
* e.g., {@code pipeliners}' Map#compute family methods
*
* @param deviceId Device to initialize pipeliner
* @return {@link Pipeliner} instance or null
*/
private Pipeliner initPipelineHandler(DeviceId deviceId) {
start = now();
// Attempt to lookup the handler in the cache
DriverHandler handler = driverHandlers.get(deviceId);
cTime = now();
if (handler == null) {
try {
// Otherwise create it and if it has pipeline behaviour, cache it
handler = driverService.createHandler(deviceId);
dTime = now();
if (!handler.driver().hasBehaviour(Pipeliner.class)) {
log.debug("Pipeline behaviour not supported for device {}", deviceId);
return null;
}
} catch (ItemNotFoundException e) {
log.warn("No applicable driver for device {}", deviceId);
return null;
}
driverHandlers.put(deviceId, handler);
eTime = now();
}
// Always (re)initialize the pipeline behaviour
log.info("Driver {} bound to device {} ... initializing driver", handler.driver().name(), deviceId);
hTime = now();
Pipeliner pipeliner = handler.behaviour(Pipeliner.class);
hbTime = now();
pipeliner.init(deviceId, context);
stopWatch();
return pipeliner;
}
use of org.onlab.util.ItemNotFoundException in project onos by opennetworkinglab.
the class FlowObjectiveCompositionManager method setupPipelineHandler.
private void setupPipelineHandler(DeviceId deviceId) {
// Attempt to lookup the handler in the cache
DriverHandler handler = driverHandlers.get(deviceId);
if (handler == null) {
try {
// Otherwise create it and if it has pipeline behaviour, cache it
handler = driverService.createHandler(deviceId);
if (!handler.driver().hasBehaviour(Pipeliner.class)) {
log.warn("Pipeline behaviour not supported for device {}", deviceId);
return;
}
} catch (ItemNotFoundException e) {
log.warn("No applicable driver for device {}", deviceId);
return;
}
driverHandlers.put(deviceId, handler);
}
// Always (re)initialize the pipeline behaviour
log.info("Driver {} bound to device {} ... initializing driver", handler.driver().name(), deviceId);
Pipeliner pipeliner = handler.behaviour(Pipeliner.class);
pipeliner.init(deviceId, context);
pipeliners.putIfAbsent(deviceId, pipeliner);
}
use of org.onlab.util.ItemNotFoundException in project onos by opennetworkinglab.
the class DomainIntentManager method initDomainIntentDriver.
private DomainIntentConfigurable initDomainIntentDriver(DeviceId deviceId) {
// Attempt to lookup the handler in the cache
DriverHandler handler = driverHandlers.get(deviceId);
if (handler == null) {
try {
// Otherwise create it and if it has DomainIntentConfig behaviour, cache it
handler = driverService.createHandler(deviceId);
if (!handler.driver().hasBehaviour(DomainIntentConfigurable.class)) {
log.warn("DomainIntentConfig behaviour not supported for device {}", deviceId);
return null;
}
} catch (ItemNotFoundException e) {
log.warn("No applicable driver for device {}", deviceId);
return null;
}
driverHandlers.put(deviceId, handler);
}
// Always (re)initialize the pipeline behaviour
log.info("Driver {} bound to device {} ... initializing driver", handler.driver().name(), deviceId);
return handler.behaviour(DomainIntentConfigurable.class);
}
Aggregations