@LogMessageDoc(level="ERROR",message="Error reading link discovery update.",explanation="Unable to process link discovery update",recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG) public List<LDUpdate> applyUpdates(){
  List<LDUpdate> appliedUpdates=new ArrayList<LDUpdate>();
  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);
    }
switch (update.getOperation()) {
case LINK_UPDATED:
      addOrUpdateLink(update.getSrc(),update.getSrcPort(),update.getDst(),update.getDstPort(),update.getType());
    break;
case LINK_REMOVED:
  removeLink(update.getSrc(),update.getSrcPort(),update.getDst(),update.getDstPort());
break;
case SWITCH_UPDATED:
addOrUpdateSwitch(update.getSrc());
break;
case SWITCH_REMOVED:
removeSwitch(update.getSrc());
break;
case TUNNEL_PORT_ADDED:
addTunnelPort(update.getSrc(),update.getSrcPort());
break;
case TUNNEL_PORT_REMOVED:
removeTunnelPort(update.getSrc(),update.getSrcPort());
break;
case PORT_UP:
case PORT_DOWN:
break;
}
appliedUpdates.add(update);
}
return (Collections.unmodifiableList(appliedUpdates));
}

@ LogMessageDoc ( level = "ERROR" , message = "Error reading link discovery update." , explanation = "Unable to process link discovery update" , recommendation = LogMessageDoc . REPORT_CONTROLLER_BUG ) public List < LDUpdate > applyUpdates ( ) { List < LDUpdate > appliedUpdates = new ArrayList < LDUpdate > ( ) ; 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 ) ; } switch ( update . getOperation ( ) ) { case LINK_UPDATED : addOrUpdateLink ( update . getSrc ( ) , update . getSrcPort ( ) , update . getDst ( ) , update . getDstPort ( ) , update . getType ( ) ) ; break ; case LINK_REMOVED : removeLink ( update . getSrc ( ) , update . getSrcPort ( ) , update . getDst ( ) , update . getDstPort ( ) ) ; break ; case SWITCH_UPDATED : addOrUpdateSwitch ( update . getSrc ( ) ) ; break ; case SWITCH_REMOVED : removeSwitch ( update . getSrc ( ) ) ; break ; case TUNNEL_PORT_ADDED : addTunnelPort ( update . getSrc ( ) , update . getSrcPort ( ) ) ; break ; case TUNNEL_PORT_REMOVED : removeTunnelPort ( update . getSrc ( ) , update . getSrcPort ( ) ) ; break ; case PORT_UP : case PORT_DOWN : break ; } appliedUpdates . add ( update ) ; } return ( Collections . unmodifiableList ( appliedUpdates ) ) ; }
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 .
