org.onosproject.net.Device.serialNumber()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.onosproject.net.Device.serialNumber()方法的一些代码示例,展示了Device.serialNumber()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.serialNumber()方法的具体详情如下:
包路径:org.onosproject.net.Device
类名称:Device
方法名:serialNumber

Device.serialNumber介绍

暂无

代码示例

代码示例来源: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-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-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)));
      }
    }
  }
}

相关文章