Exemple #1
0
  /**
   * Delete details of a specified port pair id.
   *
   * @param id port pair id
   */
  @Path("{pair_id}")
  @DELETE
  public void deletePortPair(@PathParam("pair_id") String id) {

    PortPairId portPairId = PortPairId.of(id);
    Boolean isSuccess =
        nullIsNotFound(get(PortPairService.class).removePortPair(portPairId), PORT_PAIR_NOT_FOUND);
    if (!isSuccess) {
      log.debug("Port pair identifier {} does not exist", id);
    }
  }
Exemple #2
0
 /**
  * Get details of a specified port pair id.
  *
  * @param id port pair id
  * @return 200 OK, 404 if given identifier does not exist
  */
 @GET
 @Path("{pair_id}")
 @Produces(MediaType.APPLICATION_JSON)
 public Response getPortPair(@PathParam("pair_id") String id) {
   PortPair portPair =
       nullIsNotFound(
           get(PortPairService.class).getPortPair(PortPairId.of(id)), PORT_PAIR_NOT_FOUND);
   ObjectNode result = mapper().createObjectNode();
   result.set("port_pair", codec(PortPair.class).encode(portPair, this));
   return ok(result.toString()).build();
 }
Exemple #3
0
  @Override
  public boolean removePortPair(PortPairId portPairId) {
    checkNotNull(portPairId, PORT_PAIR_NULL);

    portPairStore.remove(portPairId);
    if (portPairStore.containsKey(portPairId)) {
      log.debug("The portPair is removed failed whose identifier was {}", portPairId.toString());
      return false;
    }
    return true;
  }