public void notifyLPSEstablished(long lspId, Inet4Address src) { // Lo pongo al principio de momento porque al final de la funcion nunca llega. // No se si es un bug log.info("is Stateful??::" + isStateful); // if PCC is stateful the new LSP must be notified to the PCE if (isStateful) { log.info("LSPList: " + LSPList.size() + " " + (new LSPKey(src, lspId)).toString()); this.getNextdataBaseVersion(); notiLSP.notify( LSPList.get(new LSPKey(src, lspId)), true, true, false, false, getPCESession().getOut()); } Lock lock; Condition lspEstablished; LSPTE lsp; timeEnd = System.nanoTime(); log.info( "Time to Procces RSVP Resv Mssg in Node (ms): " + ((timeEnd_Node - timeIni_Node) / 1000000)); log.info("LSP total Time (ms): " + ((timeEnd - timeIni) / 1000000)); try { lock = lockList.get(lspId); lspEstablished = conditionList.get(lspId); lsp = LSPList.get(new LSPKey(src, lspId)); } catch (Exception e) { log.info(UtilsFunctions.exceptionToString(e)); return; } // Comento esto y la linea de abajo esto porque peta y estas que se porque log.info("lspId::" + lspId); lock.lock(); try { lspEstablished.signalAll(); } finally { log.info("notifyLSPEstablished lockList.remove"); lockList.remove(lspId); conditionList.remove(lspId); lock.unlock(); } }
public void notifyLPSEstablishmentFail(long lspId, Inet4Address src) { Lock lock; Condition lspEstablished; try { lock = lockList.get(lspId); lspEstablished = conditionList.get(lspId); } catch (Exception e) { return; } lock.lock(); try { lspEstablished.signalAll(); // lsp.set } finally { log.info("notifyLPSEstablishmentFail lockList.remove"); lockList.remove(lspId); conditionList.remove(lspId); lock.unlock(); } if (isStateful) { dataBaseVersion.incrementAndGet(); notiLSP.notify(LSPList.get(lspId), false, false, false, false, getPCESession().getOut()); } }
public void updateLSP(PCEPUpdate pupdt) { // There should be a better way to do this, but for the time being is OK log.info("Updating LSP!"); Inet4Address addres = pupdt .getUpdateRequestList() .get(0) .getLsp() .getLspIdentifiers_tlv() .getTunnelSenderIPAddress(); for (int i = 0; i < pupdt.getUpdateRequestList().size(); i++) { log.info("Address: " + addres); log.info("lspID: " + pupdt.getUpdateRequestList().get(i).getLsp().getLspId()); final LSPTE previous = LSPList.get(new LSPKey(addres, pupdt.getUpdateRequestList().get(i).getLsp().getLspId())); if ((previous == null) || (!previous.isDelegated()) || (!(previous.getDelegatedAdress().equals(PCESession.getPeerPCE_IPaddress())))) { log.warning( "An align PCE is trying to delegate on us or the LSP to be updated was not found:" + (previous == null)); log.info("PCEPErr message should be sent"); } else { if (pupdt.getUpdateRequestList().get(i).getLsp().isrFlag()) { log.info("Removing LSP due to PCEPUpdate received message"); dataBaseVersion.incrementAndGet(); deleteLSP(addres, pupdt.getUpdateRequestList().get(i).getLsp().getLspId()); notiLSP.notify(previous, false, false, true, false, getPCESession().getOut()); } else { log.info("Adding LSP due to PCEPUpdate received message"); final Path path = pupdt.getUpdateRequestList().get(i).getPath(); log.info("previous.getIdDestination()" + previous.getIdDestination()); float bw = 0; Bandwidth bww = path.getBandwidth(); if (bww != null) { if (bww instanceof BandwidthRequested) { bw = ((BandwidthRequested) bww).getBw(); } } final LSPTE lsp = new LSPTE( previous.getTunnelId(), previous.getIdSource(), previous.getIdDestination(), previous.isBidirectional(), previous.getOFcode(), bw, previous.getPathState()); ERO ero = new ERO(); ero.setEroSubobjects(path.geteRO().getEROSubobjectList()); lsp.setEro(ero); dataBaseVersion.incrementAndGet(); deleteLSP(addres, pupdt.getUpdateRequestList().get(i).getLsp().getLspId()); log.info("previous.getIdDestination()" + previous.getIdDestination()); log.info(" path.getBandwidth().getBw()" + bw); class ThreadAux extends Thread { @Override public void run() { try { sleep(2000); float bw = 0; Bandwidth bww = path.getBandwidth(); if (bww != null) { if (bww instanceof BandwidthRequested) { bw = ((BandwidthRequested) bww).getBw(); } } addnewLSP( previous.getIdDestination(), bw, previous.isBidirectional(), previous.getOFcode(), lsp.getIdLSP().intValue()); waitForLSPaddition(lsp.getIdLSP().intValue(), 10000); if (getLSP(lsp.getIdLSP().intValue(), previous.getIdSource()) == null) { log.info("Error creating LSP!!"); } } catch (InterruptedException e) { log.warning("Thread interrupted during the updating of a LSP"); e.printStackTrace(); } catch (LSPCreationException e) { log.warning("Error updating LSP"); e.printStackTrace(); } } }; new ThreadAux().start(); notiLSP.notify(lsp, true, true, false, false, getPCESession().getOut()); } } } }