Exemplo n.º 1
0
 @Override
 public void unregister(String id) throws NotFoundException {
   if (eventEndpointRepository.exists(id)) {
     log.info("Removing EventEndpoint with id: " + id);
     eventEndpointRepository.delete(id);
   }
 }
Exemplo n.º 2
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());
        }
      }
    }
  }
Exemplo n.º 3
0
 public EventEndpoint saveEventEndpoint(EventEndpoint endpoint) {
   EventEndpoint save = eventEndpointRepository.save(endpoint);
   log.info("Registered event endpoint" + save);
   return save;
 }