/**
   * Event handler called when multiple links go up or down.
   *
   * @param updateList information about the change in each link's state
   */
  @Override
  public void linkDiscoveryUpdate(List<LDUpdate> updateList) {
    for (LDUpdate update : updateList) {
      // If we only know the switch & port for one end of the link, then
      // the link must be from a switch to a host
      if (0 == update.getDst()) {
        log.info(
            String.format("Link s%s:%d -> host updated", update.getSrc(), update.getSrcPort()));
      }
      // Otherwise, the link is between two switches
      else {
        log.info(
            String.format(
                "Link s%s:%d -> s%s:%d updated",
                update.getSrc(), update.getSrcPort(), update.getDst(), update.getDstPort()));
      }
    }

    /** ****************************************************************** */
    /* TODO: Update routing: change routing rules for all hosts */
    updateAllRouting();

    /** ****************************************************************** */
  }
 /**
  * Updates concerning switch disconnect and port down are not processed. LinkDiscoveryManager is
  * expected to process those messages and send multiple link removed messages. However, all the
  * updates from LinkDiscoveryManager would be propagated to the listeners of topology.
  */
 @LogMessageDoc(
     level = "ERROR",
     message = "Error reading link discovery update.",
     explanation = "Unable to process link discovery update",
     recommendation = LogMessageDoc.REPORT_CONTROLLER_BUG)
 public void applyUpdates() {
   appliedUpdates.clear();
   LDUpdate update = null;
   while (ldUpdates.peek() != null) {
     try {
       update = ldUpdates.take();
     } catch (Exception e) {
       log.error("Error reading link discovery update.", e);
     }
     if (log.isTraceEnabled()) {
       log.trace("Applying update: {}", update);
     }
     if (update.getOperation() == UpdateOperation.LINK_UPDATED) {
       addOrUpdateLink(
           update.getSrc(),
           update.getSrcPort(),
           update.getDst(),
           update.getDstPort(),
           update.getType());
     } else if (update.getOperation() == UpdateOperation.LINK_REMOVED) {
       removeLink(
           update.getSrc(), update.getSrcPort(),
           update.getDst(), update.getDstPort());
     }
     // Add to the list of applied updates.
     appliedUpdates.add(update);
   }
 }