6. CaaS API

UCG includes a CaaS API (Configuration as a Service) for customers with an enterprise license. The CaaS API is a comprehensive interface providing customers with the full application experience through a RESTful API.

6.1 API Documentation

Ultra Config maintains API documentation using the OpenAPI Specification. For a full copy of our API documentation, contact our support team. The remainder of this section will provide an example of the "getConfiguration" API method.

6.3 Sample Request

For this example, let's imagine we want to generate a configuration snippet for a Juniper router with three requirements.

  1. Layer 3 Interface - A layer 3 interface on the physical port "ge-0/0/0" with an IP address of 10.10.10.2/30
  2. Static Route - A static route for the destination network 10.0.0.0/8 with a next-hop address of 10.0.0.1
  3. Static Route - A static route for the destination network 192.168.0.0/16 with a next-hop address of 10.0.0.1

To achieve this task, two templates will need to be created in the Template Editor. The first is a template for the layer 3 interface configuration - this template will contain one instantiation in our API request. The second is a template for the static route configuration - this template will contain two instantiations in our API request.

Once these templates have been created, we may proceed to construct an API request with a JSON body as shown below.

{
  "templates": [
    {
      "templatePrimaryKey": "5b794b468b48020c3135703c",
      "templateInputs": [
        {
          "PHYSICAL_INTERFACE": "ge-0/0/0",
          "IP_ADDRESS": "10.10.10.2/30"
        }
      ]
    },
    {
      "templatePrimaryKey": "5b794bad8b48020c3135703d",
      "templateInputs": [
        {
          "DESTINATION_NETWORK": "10.0.0.0/8",
          "NEXT_HOP_ADDRESS": "10.10.10.1"
        },
        {
          "DESTINATION_NETWORK": "192.168.0.0/16",
          "NEXT_HOP_ADDRESS": "10.10.10.1"
        }
      ]
    }
  ]
}

At the highest level of our JSON object, we have a "templates" array. There is no upper limit on the number of templates which may be activated during an API call.

Each object within the "templates" array contains a "templatePrimaryKey" field and a "templateInputs" array. The "templatePrimaryKey" field is a unique reference to a template and may be obtained from the Developer Console or fetched programmatically via a separate API method.

The "templateInputs" array contains the key-value pairs of parameters required for a template. If a variable belonging to a template is omitted the default value of that variable will be used. You'll also notice that the static route template was instantiated twice in this example simply by including an additional key-value set within the "templateInputs" array. There is no upper limit on the number of instantiations that can be made.

The API endpoint for our sample request is provided below. An authorization token will also be required as per the formal API specification.

/api/v1/configuration/getConfiguration

6.5 Sample Response

When executed correctly, a JSON body will be returned in the API response.

{
  "success": true,
  "message": "The configuration has been successfully generated.",
  "payload": {
    "templates": [
      {
        "templatePrimaryKey": "5b794b468b48020c3135703c",
        "templateDisplayName": "Layer 3 Interface",
        "templateDescription": "Layer 3 Interface template for Juniper routers",
        "templateVersion": "20",
        "templateUpdatedBy": "mel.dawson",
        "templateDateModified": 1564118172886,
        "templateDateCreated": 1539919220503,
        "configuration": "set interfaces ge-0/0/0 unit 0 family inet address 10.10.10.2/30\r\n"
      },
      {
        "templatePrimaryKey": "5b794bad8b48020c3135703d",
        "templateDisplayName": "Static Route",
        "templateDescription": "Static Route template for Juniper routers and switches",
        "templateVersion": "7",
        "templateUpdatedBy": "mel.dawson",
        "templateDateModified": 1565243111424,
        "templateDateCreated": 1539920172176,
        "configuration": "set routing-options static route 192.168.0.0/16 next-hop 10.10.10.1\r\nset routing-options static route 192.168.0.0/16 next-hop 10.10.10.1\r\n"
      }
    ]
  }
}

The JSON response includes a "templates" array inside the "payload" object. The number of elements inside the "templates" array will match that of the request.

Inside each element, several fields are returned. Most of them are metadata useful for readability and validation. The most important field, however, is the "configuration" key. The "configuration" key contains the generated configuration corresponding to the template it resides in.

Configuration spanning over multiple lines uses the standard delimiter of "\r\n".

That is all! The client may now proceed to parse the response body and push the configuration to network infrastructure.

For more information on the application APIs, please consult the formal specification or ask us a question.


Proceed to Next Page