Exemplo n.º 1
0
  public boolean checkPathStatus(LspInformation lspInformation)
      throws UnexpectedFaultException, PathNotFoundFaultException {
    final ConfigurationManager configManager =
        new ConfigurationManager(lspInformation.getSourceDevice().getModule());
    if (!configManager.getStatus(lspInformation)) {
      DbManager.insertLog(
          "Cleaned lsp with pathId "
              + lspInformation.getPathId()
              + " and description: "
              + lspInformation.getLspDescriptor());
      logger.debug(
          "Cleaned lsp with pathId "
              + lspInformation.getPathId()
              + " and description: "
              + lspInformation.getLspDescriptor());
      DbManager.deletePath(lspInformation.getPathId());
      try {
        configManager.terminatePath(lspInformation);
      } catch (final Exception ex) {
        DbManager.insertLog("Could not be deleted on router-> might be already deleted.");
        logger.debug("Could not be deleted on router-> might be already deleted.");

        logger.error(ex.getMessage(), ex);
      }
      return false;
    }
    return true;
  }
Exemplo n.º 2
0
 /**
  * Retrieve TNA information.
  *
  * @param getEndpointDiscoveryType web service parameter
  * @return GetTNADiscoveryResponseType
  * @throws UnexpectedFaultException in case of error
  */
 @SuppressWarnings("unused")
 public GetEndpointDiscoveryResponseType getEndpointDiscovery(
     final GetEndpointDiscoveryType getEndpointDiscoveryType) throws UnexpectedFaultException {
   final GetEndpointDiscoveryResponseType response = new GetEndpointDiscoveryResponseType();
   try {
     response.getEndpoint().addAll(DbManager.getEndpoints(null));
   } catch (final Exception ex) {
     throw new UnexpectedFaultException(ex);
   }
   return response;
 }
Exemplo n.º 3
0
  /**
   * GetPathDiscovery service implementation.
   *
   * @param element the request
   * @return the response
   * @throws UnexpectedFaultException
   */
  @SuppressWarnings("unused")
  public GetPathDiscoveryResponseType getPathDiscovery(final GetPathDiscoveryType element)
      throws UnexpectedFaultException {
    final GetPathDiscoveryResponseType response = new GetPathDiscoveryResponseType();
    for (final Integer i : DbManager.getAllPathIds()) {
      final PathIdentifierType pathId = new PathIdentifierType();
      pathId.setPathIdentifier(i.intValue());
      response.getPathIdentifierList().add(pathId);
    }

    return response;
  }
Exemplo n.º 4
0
 /**
  * GetPathStatus Service implementation.
  *
  * @param getPathStatusType the request
  * @return the response
  * @throws PathNotFoundFaultException
  * @throws PathNotFoundFaultException
  */
 public GetPathStatusResponseType getPathStatus(final GetPathStatusType getPathStatusType)
     throws PathNotFoundFaultException {
   final GetPathStatusResponseType response = new GetPathStatusResponseType();
   final PathType path = new PathType();
   LspInformation lspInformation;
   try {
     lspInformation =
         DbManager.getPathInformation(getPathStatusType.getPathIdentifier().getPathIdentifier());
     if (!checkPathStatus(lspInformation)) {
       logger.debug("Path does not exist anymore");
       throw new PathNotFoundFaultException("Path does not exist anymore");
     }
     path.setSourceTNA(lspInformation.getSourceDevice().getTnaAddress());
     path.setDestinationTNA(lspInformation.getDestinationDevice().getTnaAddress());
     path.setBandwidth(lspInformation.getBandwidth());
   } catch (final Exception e) {
     throw new PathNotFoundFaultException(e);
   }
   response.setPath(path);
   return response;
 }