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

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

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

Device.id介绍

暂无

代码示例

代码示例来源:origin: org.onosproject/onos-core-net

private void handleEvent(DeviceEvent event) {
    Device device = event.subject();
    boolean isRelevant = mastershipService.isLocalMaster(device.id()) &&
        deviceService.isAvailable(device.id());
    if (isRelevant) {
      pollDeviceGroups(device.id());
    }
  }
}

代码示例来源:origin: org.onosproject/onos-core-trivial

@Override
  public boolean apply(Device input) {
    return isAvailable(input.id());
  }
});

代码示例来源:origin: org.onosproject/onos-core-net

private void handleEvent(DeviceEvent event) {
    Device device = event.subject();
    boolean isRelevant = mastershipService.isLocalMaster(device.id()) &&
        deviceService.isAvailable(device.id());
    if (isRelevant) {
      pollDeviceMeters(device.id());
    }
  }
}

代码示例来源:origin: org.onosproject/onos-bmv2-provider-device

private void pollDevices() {
  for (Device device: deviceService.getAvailableDevices(SWITCH)) {
    if (device.id().uri().getScheme().equals(SCHEME) &&
        mastershipService.isLocalMaster(device.id())) {
      executorService.execute(() -> pollingTask(device.id()));
    }
  }
}

代码示例来源:origin: org.onosproject/onos-core-net

private void pollTableStatistics(Device device) {
  try {
    List<TableStatisticsEntry> tableStatsList = newArrayList(device.as(TableStatisticsDiscovery.class)
        .getTableStatistics());
    providerService.pushTableStatistics(device.id(), tableStatsList);
  } catch (Exception e) {
    log.warn("Exception thrown while polling table statistics for {}", device.id(), e);
  }
}

代码示例来源:origin: org.onosproject/onos-core-trivial

private DeviceEvent createDevice(ProviderId providerId, Device newDevice) {
  // update composed device cache
  Device oldDevice = devices.putIfAbsent(newDevice.id(), newDevice);
  verify(oldDevice == null,
      "Unexpected Device in cache. PID:%s [old=%s, new=%s]",
      providerId, oldDevice, newDevice);
  if (!providerId.isAncillary()) {
    availableDevices.add(newDevice.id());
  }
  return new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, newDevice, null);
}

代码示例来源:origin: org.onosproject/onos-core-net

private void registerDeviceResource(Device device) {
  boolean success = adminService.register(Resources.discrete(device.id()).resource());
  if (!success) {
    log.error("Failed to register Device: {}", device.id());
  }
}

代码示例来源:origin: org.onosproject/onos-cli

private ObjectNode json(ObjectMapper mapper,
            Device device, List<TableStatisticsEntry> tableStats) {
  ObjectNode result = mapper.createObjectNode();
  ArrayNode array = mapper.createArrayNode();
  tableStats.forEach(tableStat -> array.add(jsonForEntity(tableStat, TableStatisticsEntry.class)));
  result.put("device", device.id().toString())
      .put("tableCount", tableStats.size())
      .set("tables", array);
  return result;
}

代码示例来源:origin: org.onosproject/onos-core-net

private void handleEvent(DeviceEvent event) {
    Device device = event.subject();
    boolean isRelevant = mastershipService.isLocalMaster(device.id()) &&
        deviceService.isAvailable(device.id());
    if (isRelevant) {
      pollDeviceFlowEntries(device);
    }
  }
}

代码示例来源:origin: org.onosproject/onos-app-fm-mgr

@Override
public void event(DeviceEvent event) {
  log.debug("InternalDeviceListener has got event from device-service{} with ", event);
  eventHandlingExecutor.execute(() -> triggerProbe(event.subject().id()));
}

代码示例来源:origin: org.onosproject/onos-core-net

@Override
public void initPolicy(String policy) {
  checkPermission(FLOWRULE_WRITE);
  this.policy = policy;
  deviceService.getDevices().forEach(device ->
      this.deviceCompositionTreeMap.put(device.id(), FlowObjectiveCompositionUtil.parsePolicyString(policy)));
  log.info("Initialize policy {}", policy);
}

代码示例来源:origin: org.onosproject/onos-core-net

@Override
public Set<DeviceId> getDeviceIds(DomainId domainId) {
  Set<DeviceId> domainIds = new HashSet<>();
  deviceService.getAvailableDevices().forEach(dev -> {
    if (getAnnotatedDomainId(dev).equals(domainId)) {
      domainIds.add(dev.id());
    }
  });
  return domainIds;
}

代码示例来源:origin: org.onosproject/onos-core-net

private void pollMeters() {
  deviceService.getAvailableDevices().forEach(device -> {
    if (mastershipService.isLocalMaster(device.id()) &&
        device.is(MeterProgrammable.class)) {
      pollDeviceMeters(device.id());
    }
  });
}

代码示例来源:origin: org.onosproject/onos-core-net

private void pollGroups() {
  deviceService.getAvailableDevices().forEach(device -> {
    if (mastershipService.isLocalMaster(device.id()) &&
        device.is(GroupProgrammable.class)) {
      pollDeviceGroups(device.id());
    }
  });
}

代码示例来源:origin: org.onosproject/onos-core-net

private void invalidatePipelinerIfNecessary(Device device) {
  DriverHandler handler = driverHandlers.get(device.id());
  if (handler != null &&
      !Objects.equals(handler.driver().name(),
              device.annotations().value(DRIVER))) {
    invalidatePipeliner(device.id());
  }
}

代码示例来源:origin: org.onosproject/onos-core-net

@Override
public SummaryFlowEntryWithLoad loadSummary(Device device, PortNumber pNumber) {
  checkPermission(STATISTIC_READ);
  ConnectPoint cp = new ConnectPoint(device.id(), pNumber);
  return loadSummaryPortInternal(cp);
}

代码示例来源:origin: org.onosproject/onos-core-net

private boolean isLocalMaster(Device device) {
  if (mastershipService.isLocalMaster(device.id())) {
    return true;
  }
  // The device might have no master (e.g. after it has been disconnected
  // from core), hence we use device mastership state.
  final MastershipInfo info = mastershipService.getMastershipFor(device.id());
  return !info.master().isPresent() &&
      device.is(DeviceHandshaker.class) &&
      device.as(DeviceHandshaker.class).getRole()
          .equals(MastershipRole.MASTER);
}

代码示例来源:origin: org.onosproject/onos-core-net

@Override
public List<FlowEntryWithLoad> loadAllByType(Device device, PortNumber pNumber,
                      FlowEntry.FlowLiveType liveType,
                      Instruction.Type instType) {
  checkPermission(STATISTIC_READ);
  ConnectPoint cp = new ConnectPoint(device.id(), pNumber);
  return loadAllPortInternal(cp, liveType, instType);
}

代码示例来源:origin: org.onosproject/onos-core-net

private void unregisterPortResource(Device device, Port port) {
  DiscreteResource portResource = Resources.discrete(device.id(), port.number()).resource();
  List<Resource> allResources = getDescendantResources(portResource);
  adminService.unregister(Lists.transform(allResources, Resource::id));
}

代码示例来源:origin: org.onosproject/onos-app-fm-mgr

@Override
public boolean isRelevant(DeviceEvent event) {
  return event.type().equals(DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED)
      && deviceService.isAvailable(event.subject().id());
}

相关文章