本文整理了Java中org.onosproject.net.Device.hwVersion()
方法的一些代码示例,展示了Device.hwVersion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.hwVersion()
方法的具体详情如下:
包路径:org.onosproject.net.Device
类名称:Device
方法名:hwVersion
暂无
代码示例来源:origin: org.onosproject/onos-cli
private String getDeviceString(Device dev) {
StringBuilder buf = new StringBuilder();
if (dev != null) {
buf.append(String.format("Device: %s, ", dev.id()));
buf.append(String.format("%s, ", dev.type()));
buf.append(String.format("%s, ", dev.manufacturer()));
buf.append(String.format("%s, ", dev.hwVersion()));
buf.append(String.format("%s, ", dev.swVersion()));
if (dev instanceof DefaultDevice) {
DefaultDevice dfltDev = (DefaultDevice) dev;
if (dfltDev.driver() != null) {
buf.append(String.format("%s, ", dfltDev.driver().name()));
}
String channelId = dfltDev.annotations().value("channelId");
if (channelId != null) {
buf.append(String.format("%s, ", channelId));
}
}
}
return buf.toString();
}
代码示例来源:origin: org.onosproject/onos-core-common
@Override
public ObjectNode encode(Device device, CodecContext context) {
checkNotNull(device, "Device cannot be null");
DeviceService service = context.getService(DeviceService.class);
DriverService driveService = context.getService(DriverService.class);
ObjectNode result = context.mapper().createObjectNode()
.put(ID, device.id().toString())
.put(TYPE, device.type().name())
.put(AVAILABLE, service.isAvailable(device.id()))
.put(ROLE, service.getRole(device.id()).toString())
.put(MFR, device.manufacturer())
.put(HW, device.hwVersion())
.put(SW, device.swVersion())
.put(SERIAL, device.serialNumber())
.put(DRIVER, driveService.getDriver(device.id()).name())
.put(CHASSIS_ID, device.chassisId().toString())
.put(LAST_UPDATE, Long.toString(service.getLastUpdatedInstant(device.id())))
.put(HUMAN_READABLE_LAST_UPDATE, service.localStatus(device.id()));
return annotate(result, device, context);
}
代码示例来源:origin: org.onosproject/onos-core-trivial
private DeviceEvent updateDevice(ProviderId providerId, Device oldDevice, Device newDevice) {
!Objects.equals(oldDevice.hwVersion(), newDevice.hwVersion()) ||
!Objects.equals(oldDevice.swVersion(), newDevice.swVersion());
boolean annotationsChanged =
代码示例来源:origin: org.onosproject/onos-core-net
/**
* Returns a description of the given device.
*
* @param device the device
* @return a description of the device
*/
public static DeviceDescription descriptionOf(Device device) {
checkNotNull(device, "Must supply non-null Device");
return new DefaultDeviceDescription(device.id().uri(), device.type(),
device.manufacturer(), device.hwVersion(),
device.swVersion(), device.serialNumber(),
device.chassisId(), (SparseAnnotations) device.annotations());
}
}
代码示例来源:origin: org.onosproject/onos-core-net
@Override
public Driver getDriver(DeviceId deviceId) {
checkPermission(DRIVER_READ);
Driver driver;
// Special processing for devices with pipeconf.
if (pipeconfService.ofDevice(deviceId).isPresent()) {
// No fallback for pipeconf merged drivers. Returns null if driver
// does not exist.
return getPipeconfMergedDriver(deviceId);
}
// Primary source of driver configuration is the network config.
BasicDeviceConfig cfg = networkConfigService.getConfig(deviceId, BasicDeviceConfig.class);
driver = lookupDriver(cfg != null ? cfg.driver() : null);
if (driver != null) {
return driver;
}
// Secondary source of the driver selection is driver annotation.
Device device = nullIsNotFound(deviceService.getDevice(deviceId), NO_DEVICE);
driver = lookupDriver(device.annotations().value(DRIVER));
if (driver != null) {
return driver;
}
// Tertiary source of the driver selection is the primordial information
// obtained from the device.
return nullIsNotFound(getDriver(device.manufacturer(),
device.hwVersion(), device.swVersion()),
NO_DRIVER);
}
代码示例来源:origin: org.onosproject/onos-cli
/**
* Prints information about the specified device.
*
* @param deviceService device service
* @param device infrastructure device
*/
protected void printDevice(DeviceService deviceService, Device device) {
if (device != null) {
String driver = get(DriverService.class).getDriver(device.id()).name();
if (shortOnly) {
print(FMT_SHORT, device.id(), deviceService.isAvailable(device.id()),
deviceService.getRole(device.id()), device.type(), driver);
} else {
print(FMT, device.id(), deviceService.isAvailable(device.id()),
deviceService.localStatus(device.id()),
deviceService.getRole(device.id()), device.type(),
device.manufacturer(), device.hwVersion(), device.swVersion(),
device.serialNumber(), device.chassisId(), driver,
annotations(device.annotations(), ImmutableSet.of(AnnotationKeys.DRIVER)));
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!