Tabnine Logo
DeviceEvent
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using org.onosproject.net.device.DeviceEvent (Showing top 20 results out of 315)

origin: org.onosproject/onos-core-net

@Override
public boolean isRelevant(DeviceEvent event) {
  Device device = event.subject();
  return POSITIVE_DEVICE_EVENT.contains(event.type()) &&
      device.is(GroupProgrammable.class);
}
origin: org.onosproject/onos-core-net

  @Override
  public void event(DeviceEvent event) {
    if (event.type() == DeviceEvent.Type.DEVICE_REMOVED) {
      removeLinks(event.subject().id());
    } else if (event.type() == DeviceEvent.Type.PORT_REMOVED) {
      removeLinks(new ConnectPoint(event.subject().id(),
          event.port().number()));
    }
  }
}
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-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 event(DeviceEvent event) {
    DeviceEvent.Type type = event.type();
    if (type == DEVICE_ADDED || type == DEVICE_REMOVED ||
        type == DEVICE_AVAILABILITY_CHANGED) {
      processEvent(event);
    }
  }
}
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-net

@Override
public void deletePort(DeviceId deviceId, PortDescription basePortDescription) {
  checkNotNull(deviceId, DEVICE_ID_NULL);
  checkNotNull(basePortDescription, PORT_DESCRIPTION_NULL);
  checkValidity();
  if (!mastershipService.isLocalMaster(deviceId)) {
    // Never been a master for this device
    // any update will be ignored.
    log.trace("Ignoring {} port update on standby node. {}", deviceId,
         basePortDescription);
    return;
  }
  Device device = getDevice(deviceId);
  if (device == null) {
    log.trace("Device not found: {}", deviceId);
  }
  PortDescription newPortDescription = DefaultPortDescription.builder(basePortDescription)
    .isRemoved(true)
    .build();
  final DeviceEvent event = store.updatePortStatus(this.provider().id(),
                           deviceId,
                           newPortDescription);
  if (event != null) {
    log.info("Device {} port {} status changed", deviceId, event.port().number());
    post(event);
  }
}
origin: org.onosproject/onos-core-net

  @Override
  public void event(DeviceEvent event) {
    eventHandlingExecutor.execute(() -> {
      try {
        if (driverService == null) {
          // Event came in after the driver service shut down, nothing to be done
          return;
        }
        Device device = event.subject();
        Driver driver = driverService.getDriver(device.id());
        if (driver == null) {
          return;
        }
        if (!Boolean.parseBoolean(driver.getProperty(SUPPORT_PACKET_REQUEST_PROPERTY))) {
          return;
        }
        if (!deviceService.isAvailable(event.subject().id())) {
          return;
        }
        pushRulesToDevice(device);
      } catch (Exception e) {
        log.warn("Failed to process {}", event, e);
      }
    });
  }
}
origin: org.onosproject/onos-core-net

  @Override
  public void event(DeviceEvent event) {
    if (event.type() == PORT_STATS_UPDATED) {
      return;
    }
    processDeviceEvent(event);
  }
}
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-net

                         portDescription);
if (event != null) {
  log.info("Device {} port {} status changed", deviceId, event.port().number());
  post(event);
origin: org.onosproject/onos-core-net

@Override
public boolean isRelevant(DeviceEvent event) {
  Device device = event.subject();
  return POSITIVE_DEVICE_EVENT.contains(event.type()) &&
      device.is(FlowRuleProgrammable.class);
}
origin: org.onosproject/onos-app-openstackswitching

DeviceEvent deviceEvent = (DeviceEvent) event;
switch (deviceEvent.type()) {
  case DEVICE_ADDED:
    log.debug("device {} is added", deviceEvent.subject().id());
    break;
  case DEVICE_AVAILABILITY_CHANGED:
    Device device = deviceEvent.subject();
    if (deviceService.isAvailable(device.id())) {
      log.debug("device {} is added", device.id());
    processPortUpdated(deviceEvent.subject(), deviceEvent.port());
    break;
  case PORT_UPDATED:
    processPortUpdated(deviceEvent.subject(), deviceEvent.port());
    break;
  case PORT_REMOVED:
    processPortRemoved(deviceEvent.port());
    break;
  default:
    log.debug("Unsupported deviceEvent type {}", deviceEvent.type().toString());
    break;
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-core-net

@Override
public boolean isRelevant(DeviceEvent event) {
  return event.type() == DeviceEvent.Type.DEVICE_ADDED ||
      event.type() == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED;
}
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-net

@Override
public boolean isRelevant(DeviceEvent event) {
  Device device = event.subject();
  return POSITIVE_DEVICE_EVENT.contains(event.type()) &&
      device.is(MeterProgrammable.class);
}
origin: org.onosproject/onos-core-net

private void processDeviceEvent(DeviceEvent event) {
  //FIXME handle the case where a device is suspended, this may or may not come up
  DeviceEvent.Type type = event.type();
  DeviceId id = event.subject().id();
  if (type == DEVICE_ADDED ||
      type == DEVICE_AVAILABILITY_CHANGED && deviceService.isAvailable(id)) {
    // When device is added or becomes available, add all its ports
    deviceService.getPorts(event.subject().id())
        .forEach(p -> addEdgePort(new ConnectPoint(id, p.number())));
  } else if (type == DEVICE_REMOVED ||
      type == DEVICE_AVAILABILITY_CHANGED && !deviceService.isAvailable(id)) {
    // When device is removed or becomes unavailable, remove all its ports.
    // Note: cannot rely on Device subsystem, ports may be gone.
    Optional.ofNullable(connectionPoints.remove(id))
      .orElse(ImmutableSet.of())
      .forEach(point -> post(new EdgePortEvent(EDGE_PORT_REMOVED, point)));
  } else if (type == DeviceEvent.Type.PORT_ADDED ||
      type == PORT_UPDATED && event.port().isEnabled()) {
    addEdgePort(new ConnectPoint(id, event.port().number()));
  } else if (type == DeviceEvent.Type.PORT_REMOVED ||
      type == PORT_UPDATED && !event.port().isEnabled()) {
    removeEdgePort(new ConnectPoint(id, event.port().number()));
  }
}
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-lldp-provider

  @Override
  public void event(DeviceEvent event) {
    if (event.type() == Type.PORT_STATS_UPDATED) {
      return;
    }
    Runnable deviceEventProcessor = new DeviceEventProcessor(event);
    eventExecutor.execute(deviceEventProcessor);
  }
}
org.onosproject.net.deviceDeviceEvent

Most used methods

  • subject
  • type
  • port
  • <init>
  • time

Popular in Java

  • Reading from database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • requestLocationUpdates (LocationManager)
  • onRequestPermissionsResult (Fragment)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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