use of org.onosproject.net.config.basics.BasicDeviceConfig in project onos by opennetworkinglab.
the class PiPipeconfManager method checkMissingMergedDriver.
private void checkMissingMergedDriver(DeviceId deviceId) {
final PiPipeconfId pipeconfId = pipeconfMappingStore.getPipeconfId(deviceId);
final BasicDeviceConfig cfg = cfgService.getConfig(deviceId, BasicDeviceConfig.class);
if (pipeconfId == null) {
// No pipeconf associated.
return;
}
if (cfg == null || cfg.driver() == null) {
log.warn("Missing basic device config or driver key in netcfg for " + "{}, which is odd since it has a " + "pipeconf associated ({})", deviceId, pipeconfId);
return;
}
final String baseDriverName = cfg.driver();
final String mergedDriverName = mergedDriverName(baseDriverName, pipeconfId);
if (driverExists(mergedDriverName) || missingMergedDrivers.contains(mergedDriverName)) {
// Not missing, or already aware of it missing.
return;
}
log.info("Detected missing merged driver: {}", mergedDriverName);
missingMergedDrivers.add(mergedDriverName);
// Attempt building the driver now if all pieces are present.
// If not, either a driver or pipeconf event will re-trigger
// the process.
attemptDriverMerge(mergedDriverName);
}
use of org.onosproject.net.config.basics.BasicDeviceConfig in project onos by opennetworkinglab.
the class CreateNullDevice method doExecute.
@Override
protected void doExecute() {
NullProviders service = get(NullProviders.class);
NetworkConfigService cfgService = get(NetworkConfigService.class);
TopologySimulator simulator = service.currentSimulator();
if (!validateSimulator(simulator) || !validateLocType(locType)) {
return;
}
CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
DeviceId deviceId = id == null ? sim.nextDeviceId() : DeviceId.deviceId(id);
BasicDeviceConfig cfg = cfgService.addConfig(deviceId, BasicDeviceConfig.class);
cfg.name(name);
setUiCoordinates(cfg, locType, latOrY, longOrX);
Tools.delay(10);
sim.createDevice(deviceId, name, Device.Type.valueOf(type.toUpperCase()), hw, sw, portCount);
}
use of org.onosproject.net.config.basics.BasicDeviceConfig in project onos by opennetworkinglab.
the class TopologyViewMessageHandlerBase method deviceMessage.
// Produces a device event message to the client.
protected ObjectNode deviceMessage(DeviceEvent event) {
Device device = event.subject();
String uiType = device.annotations().value(AnnotationKeys.UI_TYPE);
String driverName = device.annotations().value(DRIVER);
Driver driver = driverName == null ? null : services.driver().getDriver(driverName);
String devType = uiType != null ? uiType : (driver != null ? driver.getProperty(AnnotationKeys.UI_TYPE) : null);
if (devType == null) {
devType = device.type().toString().toLowerCase();
}
String name = device.annotations().value(AnnotationKeys.NAME);
name = isNullOrEmpty(name) ? device.id().toString() : name;
ObjectNode payload = objectNode().put("id", device.id().toString()).put("type", devType).put("online", services.device().isAvailable(device.id())).put("master", master(device.id()));
payload.set("labels", labels("", name, device.id().toString()));
payload.set("props", props(device.annotations()));
BasicDeviceConfig cfg = get(NetworkConfigService.class).getConfig(device.id(), BasicDeviceConfig.class);
if (!addLocation(cfg, payload)) {
addMetaUi(device.id().toString(), payload);
}
String type = DEVICE_EVENT.get(event.type());
return JsonUtils.envelope(type, payload);
}
Aggregations