コード例 #1
0
  @Override
  public void dispatchEvent(EventNFVO event) {
    log.debug("dispatching event to the world!!!");
    log.debug("event is: " + event);

    Iterable<EventEndpoint> endpoints = eventEndpointRepository.findAll();

    for (EventEndpoint endpoint : endpoints) {
      log.debug("Checking endpoint: " + endpoint);
      if (endpoint.getEvent().ordinal() == event.getEventNFVO().getAction().ordinal()) {
        if (endpoint.getVirtualNetworkFunctionId() != null) {
          if (event.getEventNFVO().getPayload() instanceof VirtualNetworkFunctionRecord) {
            if (((VirtualNetworkFunctionRecord) event.getEventNFVO().getPayload())
                .getId()
                .equals(endpoint.getVirtualNetworkFunctionId())) {
              log.debug("dispatching event to: " + endpoint);
              sendEvent(endpoint, event.getEventNFVO());
            }
          }
        } else if (endpoint.getNetworkServiceId() != null) {
          if (event.getEventNFVO().getPayload() instanceof NetworkServiceRecord) {
            if (((NetworkServiceRecord) event.getEventNFVO().getPayload())
                .getId()
                .equals(endpoint.getNetworkServiceId())) {
              log.debug("dispatching event to: " + endpoint);
              sendEvent(endpoint, event.getEventNFVO());
            }
          }
        } else {
          log.debug("dispatching event to: " + endpoint);
          sendEvent(endpoint, event.getEventNFVO());
        }
      }
    }
  }
コード例 #2
0
  @Override
  public void onApplicationEvent(EventNFVO event) {
    log.debug("Received event: " + event);
    switch (event.getEventNFVO().getAction()) {
      case INSTANTIATE_FINISH:
        break;
      case ALLOCATE_RESOURCES:
        break;
      case ERROR:
        break;
      case RELEASE_RESOURCES:
        break;
      case INSTANTIATE:
        break;
      case MODIFY:
        break;
    }

    dispatchEvent(event);
  }