Test Your Blueprint Deployment

To test the deployment of a blueprint, you use the Blueprint APIs to make a POST request with the blueprint ID as input.

Before deploying a blueprint, you can test the syntax and placement of your blueprint to ensure deployment viability. If errors are reported in the test, you must fix the errors and test again before deploying the blueprint.

Prerequisites

Procedure

  1. Assign the blueprint ID variable.
    blueprint_id='<your_blueprint_id>'
  2. Assign image mapping and flavor mapping variables for the blueprint you intend to deploy.
    image_mapping='<your_image_mapping_name>'
    flavor_mapping='<your_flavor_mapping_name>'
    

    The image mapping specifies the OS image for a VM. The flavor mapping specifies the CPU count and RAM of a VM.

  3. Test the blueprint deployment.
    curl -X POST \
      $url/blueprint/api/blueprint-requests?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" \
      -H 'Content-Type: application/json' \
      -d '{
        "simulate":true,
        "blueprintId": "'"$blueprint_id"'",
        "inputs": {
            "count": 2,
            "image":"'"$image_mapping"'",
            "flavor":"'"$flavor_mapping"'"
        }
    }' | jq "."
  4. Examine the response and assign the blueprint request ID.
    blueprint_request_id='<your_blueprint_request_id>'
  5. Get the status of the test request.
    curl -X GET \
      $url/blueprint/api/blueprint-requests/$blueprint_request_id?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."

Example: Test a Deployment

For a blueprint with ID 1f170637-81a3-4257-b1cd-b2219ee8034c, test the deployment with image mapping set to ubuntu and flavor mapping set to small.

Assign variables.

$ url='https://appliance.domain.com'
$ api_version='2019-09-12'
$ blueprint_id='1f170637-81a3-4257-b1cd-b2219ee8034c'
$ image_mapping='ubuntu'
$ flavor_mapping='small'

Test the blueprint deployment.

$ curl -X POST \
  $url/blueprint/api/blueprint-requests?apiVersion=$api_version \
  -H "Authorization: Bearer $access_token" \
  -H 'Content-Type: application/json' \
  -d '{
    "simulate":true,
    "blueprintId": "'"$blueprint_id"'",
    "inputs": {
        "count": 2,
        "image":"'"$image_mapping"'",
        "flavor":"'"$flavor_mapping"'"
    }
}' | jq "."

A snippet of the response shows the blueprint request ID.

{  
  "id": "5c33355e-fc52-4a30-97c3-3752cf9b644e",
  "createdAt": "2019-10-11T00:11:55.544Z",
...
  "blueprintId": "1f170637-81a3-4257-b1cd-b2219ee8034c",
...

Assign the blueprint request ID variable.

$ blueprint_request_id='5c33355e-fc52-4a30-97c3-3752cf9b644e'

Request the status of the deployment.

$ curl -X GET \
  $url/blueprint/api/blueprint-requests/$blueprint_request_id?apiVersion=$api_version \
  -H "Authorization: Bearer $access_token" | jq "."

A snippet of the response shows the status of the deployment test request.

...
  "blueprintId": "1f170637-81a3-4257-b1cd-b2219ee8034c",
  "inputs": {
    "count": 2,
    "image": "ubuntu",
    "flavor": "small"
  },
  "status": "FINISHED",
...

What to do next

If your test deployment is successful, you are ready to deploy your blueprint.