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

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

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

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 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 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

@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-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 notify(DeviceEvent event) {
    post(event);
    if (event.type().equals(DeviceEvent.Type.DEVICE_REMOVED)) {
      // When device is administratively removed, force disconnect.
      DeviceId deviceId = event.subject().id();
      deviceLocalStatus.remove(deviceId);
      DeviceProvider provider = getProvider(deviceId);
      if (provider != null) {
        log.info("Triggering disconnect for device {}", deviceId);
        try {
          provider.triggerDisconnect(deviceId);
        } catch (UnsupportedOperationException e) {
          log.warn("Unable to trigger disconnect due to {}", e.getMessage());
        }
      }
    }
  }
}
origin: org.onosproject/onos-app-routing-api

  @Override
  public void event(DeviceEvent event) {
    switch (event.type()) {
    case DEVICE_ADDED:
    case DEVICE_AVAILABILITY_CHANGED:
      if (deviceService.isAvailable(event.subject().id())) {
        DeviceId deviceId = event.subject().id();
        CompletableFuture<DeviceId> future = devices.get(deviceId);
        if (future != null) {
          future.complete(deviceId);
        }
      }
      break;
    case DEVICE_UPDATED:
    case DEVICE_REMOVED:
    case DEVICE_SUSPENDED:
    case PORT_ADDED:
    case PORT_UPDATED:
    case PORT_REMOVED:
    default:
      break;
    }
  }
}
origin: org.onosproject/onos-app-routing

  @Override
  public void event(DeviceEvent event) {
    switch (event.type()) {
    case DEVICE_ADDED:
    case DEVICE_AVAILABILITY_CHANGED:
      if (deviceService.isAvailable(event.subject().id())) {
        log.info("Device connected {}", event.subject().id());
        if (event.subject().id().equals(deviceId)) {
          updateDevice();
        }
      }
      break;
    // TODO other cases
    case DEVICE_UPDATED:
    case DEVICE_REMOVED:
    case DEVICE_SUSPENDED:
    case PORT_ADDED:
    case PORT_UPDATED:
    case PORT_REMOVED:
    default:
      break;
    }
  }
}
origin: org.onosproject/onos-app-routing

  @Override
  public void event(DeviceEvent event) {
    if (controlPlaneConnectPoint != null &&
        event.subject().id().equals(controlPlaneConnectPoint.deviceId())) {
      switch (event.type()) {
      case DEVICE_ADDED:
      case DEVICE_AVAILABILITY_CHANGED:
        if (deviceService.isAvailable(event.subject().id())) {
          log.info("Device connected {}", event.subject().id());
          updateDevice();
        }
        break;
      case DEVICE_UPDATED:
      case DEVICE_REMOVED:
      case DEVICE_SUSPENDED:
      case PORT_ADDED:
      case PORT_UPDATED:
      case PORT_REMOVED:
      default:
        break;
      }
    }
  }
}
origin: org.onosproject/onos-core-net

  @Override
  public void event(DeviceEvent event) {
    DeviceEvent.Type type = event.type();
    DeviceId deviceId = event.subject().id();
    if (type == PORT_STATS_UPDATED) {
      // Update port load
      updateDeviceData(deviceId);
    } else if (type == DEVICE_REMOVED ||
        (type == DEVICE_AVAILABILITY_CHANGED &&
            !deviceService.isAvailable(deviceId))) {
      // Clean-up all port loads
      pruneDeviceData(deviceId);
    }
  }
}
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());
}
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 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-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-net

  @Override
  public void event(DeviceEvent event) {
    switch (event.type()) {
      case DEVICE_REMOVED:
      case DEVICE_AVAILABILITY_CHANGED:
        DeviceId deviceId = event.subject().id();
        if (!deviceService.isAvailable(deviceId)) {
          if (purgeOnDisconnection) {
            store.purgeFlowRule(deviceId);
          }
        }
        break;
      default:
        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) {
      pollDeviceMeters(device.id());
    }
  }
}
origin: org.onosproject/onos-core-net

  private void processEventInternal(DeviceEvent event) {
    switch (event.type()) {
      case DEVICE_REMOVED:
      case DEVICE_AVAILABILITY_CHANGED:
        DeviceId deviceId = event.subject().id();
        if (!deviceService.isAvailable(deviceId)) {
          log.debug("Device {} became unavailable for {}; clearing initial audit status",
              deviceId, event.type());
          store.deviceInitialAuditCompleted(deviceId, false);
          if (purgeOnDisconnection) {
            store.purgeGroupEntry(deviceId);
          }
        }
        break;
      default:
        break;
    }
  }
}
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-net

  @Override
  public void event(DeviceEvent event) {
    final Device device = event.subject();
    switch (event.type()) {
      case DEVICE_ADDED:
      case DEVICE_UPDATED:
      case DEVICE_AVAILABILITY_CHANGED:
        if (!deviceService.isAvailable(device.id())) {
          signalStatusUnknown(device.id());
        }
        break;
      case DEVICE_REMOVED:
      case DEVICE_SUSPENDED:
        signalStatusUnknown(device.id());
        break;
      case PORT_ADDED:
      case PORT_UPDATED:
      case PORT_REMOVED:
      case PORT_STATS_UPDATED:
      default:
        break;
    }
  }
}
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()));
  }
}
org.onosproject.net.deviceDeviceEventsubject

Popular methods of DeviceEvent

  • type
  • port
  • <init>
  • time

Popular in Java

  • Reading from database using SQL prepared statement
  • compareTo (BigDecimal)
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Top plugins for Android Studio
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