Tabnine Logo
DeviceEvent.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.onosproject.net.device.DeviceEvent
constructor

Best Java code snippets using org.onosproject.net.device.DeviceEvent.<init> (Showing top 9 results out of 315)

origin: org.onosproject/onos-core-trivial

private DeviceEvent createPort(Device device, Port newPort,
                Map<PortNumber, Port> ports) {
  ports.put(newPort.number(), newPort);
  return new DeviceEvent(PORT_ADDED, device, newPort);
}
origin: org.onosproject/onos-core-trivial

private List<DeviceEvent> pruneOldPorts(Device device,
                    Map<PortNumber, Port> ports,
                    Set<PortNumber> processed) {
  List<DeviceEvent> events = new ArrayList<>();
  Iterator<Entry<PortNumber, Port>> iterator = ports.entrySet().iterator();
  while (iterator.hasNext()) {
    Entry<PortNumber, Port> e = iterator.next();
    PortNumber portNumber = e.getKey();
    if (!processed.contains(portNumber)) {
      events.add(new DeviceEvent(PORT_REMOVED, device, e.getValue()));
      iterator.remove();
    }
  }
  return events;
}
origin: org.onosproject/onos-core-trivial

@Override
public DeviceEvent removeDevice(DeviceId deviceId) {
  Map<ProviderId, DeviceDescriptions> descs = getOrCreateDeviceDescriptions(deviceId);
  synchronized (descs) {
    Device device = devices.remove(deviceId);
    // should DEVICE_REMOVED carry removed ports?
    Map<PortNumber, Port> ports = devicePorts.get(deviceId);
    if (ports != null) {
      ports.clear();
    }
    availableDevices.remove(deviceId);
    descs.clear();
    return device == null ? null :
        new DeviceEvent(DEVICE_REMOVED, device, null);
  }
}
origin: org.onosproject/onos-core-trivial

@Override
public DeviceEvent markOffline(DeviceId deviceId) {
  Map<ProviderId, DeviceDescriptions> providerDescs
      = getOrCreateDeviceDescriptions(deviceId);
  // locking device
  synchronized (providerDescs) {
    Device device = devices.get(deviceId);
    if (device == null) {
      return null;
    }
    boolean removed = availableDevices.remove(deviceId);
    if (removed) {
      // TODO: broadcast ... DOWN only?
      return new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, device, null);
    }
    return null;
  }
}
origin: org.onosproject/onos-core-trivial

@Override
public DeviceEvent updatePortStatistics(ProviderId providerId, DeviceId deviceId,
                    Collection<PortStatistics> portStats) {
  ConcurrentMap<PortNumber, PortStatistics> statsMap = devicePortStats.get(deviceId);
  if (statsMap == null) {
    statsMap = Maps.newConcurrentMap();
    devicePortStats.put(deviceId, statsMap);
  }
  for (PortStatistics stat: portStats) {
    PortNumber portNumber = PortNumber.portNumber(stat.port());
    statsMap.put(portNumber, stat);
  }
  return new DeviceEvent(PORT_STATS_UPDATED,  devices.get(deviceId), null);
}
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-trivial

  availableDevices.add(newDevice.id());
return new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null);
boolean added = availableDevices.add(newDevice.id());
return !added ? null :
    new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null);
origin: org.onosproject/onos-apps-optical-model

/**
 * Transform Port instance on the event to Optical specific port, if it is well-formed.
 *
 * @param event original event to transform
 * @return transformed {@link DeviceEvent}
 */
public DeviceEvent augment(DeviceEvent event) {
  final Port port = augment(event.port());
  if (port == event.port()) {
    // If the Port not changed, pass through
    return event;
  }
  return new DeviceEvent(event.type(), event.subject(), port, event.time());
}
origin: org.onosproject/onos-core-trivial

private DeviceEvent updatePort(Device device, Port oldPort,
                Port newPort,
                Map<PortNumber, Port> ports) {
  if (oldPort.isEnabled() != newPort.isEnabled() ||
      oldPort.type() != newPort.type() ||
      oldPort.portSpeed() != newPort.portSpeed() ||
      !AnnotationsUtil.isEqual(oldPort.annotations(), newPort.annotations())) {
    ports.put(oldPort.number(), newPort);
    return new DeviceEvent(PORT_UPDATED, device, newPort);
  }
  return null;
}
org.onosproject.net.deviceDeviceEvent<init>

Popular methods of DeviceEvent

  • subject
  • type
  • port
  • time

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • setContentView (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • BoxLayout (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now