コード例 #1
0
 /**
  * Returns the system control block
  *
  * @param none Identifier of the mapping
  * @return System Control Block
  *     <pre>
  *
  * Example:
  *
  * Request URL:
  * http://localhost:8080/controller/nb/v2/opendove/odmc/system
  *
  * Response body in JSON:
  * {
  *    "domain_separation": false,
  *    "snat_pool_size": 1,
  *    "egw_replication_factor": 1
  * }
  * </pre>
  */
 @GET
 @Produces({MediaType.APPLICATION_JSON})
 @StatusCodes({
   @ResponseCode(code = 200, condition = "Operation successful"),
   @ResponseCode(code = 401, condition = "Unauthorized"),
   @ResponseCode(code = 501, condition = "Not Implemented")
 })
 public Response showSubnet() {
   IfNBSystemRU systemInterface = OpenDoveNBInterfaces.getIfNBSystemRU("default", this);
   if (systemInterface == null) {
     throw new ServiceUnavailableException(
         "System RU Interface " + RestMessages.SERVICEUNAVAILABLE.toString());
   }
   return Response.status(200).entity(systemInterface.getSystemBlock()).build();
 }
コード例 #2
0
  /**
   * Updates the control block
   *
   * @param input system control block in patch format
   * @return Updated System Control Block
   *     <pre>
   *
   * Example:
   *
   * Request URL:
   * http://localhost:8080/controller/nb/v2/opendove/odmc/system
   *
   * Request body in JSON:
   * {
   *    "domain_separation": true
   * }
   *
   * Response body in JSON:
   * {
   *    "domain_separation": true,
   *    "snat_pool_size": 1,
   *    "egw_replication_factor": 1
   * }
   * </pre>
   */
  @PUT
  @Produces({MediaType.APPLICATION_JSON})
  @Consumes({MediaType.APPLICATION_JSON})
  @StatusCodes({
    @ResponseCode(code = 200, condition = "Operation successful"),
    @ResponseCode(code = 400, condition = "Bad Request"),
    @ResponseCode(code = 401, condition = "Unauthorized"),
    @ResponseCode(code = 501, condition = "Not Implemented")
  })
  public Response updateSubnet(final OpenDoveNeutronControlBlock input) {
    IfNBSystemRU systemInterface = OpenDoveNBInterfaces.getIfNBSystemRU("default", this);
    if (systemInterface == null) {
      throw new ServiceUnavailableException(
          "System RU Interface " + RestMessages.SERVICEUNAVAILABLE.toString());
    }

    // update network object and return the modified object
    systemInterface.updateControlBlock(input);
    return Response.status(200).entity(systemInterface.getSystemBlock()).build();
  }