Lab Equipment REST APIs

About XPRESSO Lab Equipment REST APIs

XPRESSO provides the following public REST APIs to retrieve lab equipment-related (testbeds and topologies) information.

Retrieve Testbeds

Returns testbeds defined under group.

  • URL: /api/v1/testbeds
  • Method: GET
  • Permission Required: No permission required.
  • Group: retrieved from headers
  • Success Response
    • Condition: Authorized User.
    • Code: 200 OK
    • Response example:
      [
        {
          "uuid": "24276d46-e652-4fd8-addc-1ad0830a6008",
          "topology": "8604a664-37b2-4850-a6fd-446197dea87b",
          "name": "My-Testbed",
          "description": "This is my awesome testbed!",
          "date_created": "2019-06-02T15:35:04.642772Z",
          "link_id": "c7b43224-ee38-4a33-9a1e-2a95c22c4a6f",
          "max_reservation_time": 86400,
          "max_retention_period": 43200,
          "site": "SITE",
          "bldg": "ALL",
          "reservation_disabled": false,
          "clean_instruction_id": "7cb5b816-df41-4d4f-8b01-579c64ccb99c",
          "devices": [
            {
              "name": "P1",
              "source": 0,
              "uuid": "cfe9effb-938a-454b-a6fc-b4ec0a40d744",
              "description": null,
              "operational_state": "FREE",
              "deleted": false,
              "type": "router",
              "entity_type": "Device",
              "configuration_state": "ENABLED",
              "os": "nxos",
              "created_time": "2019-06-02T15:35:05.163101Z",
              "connections": [
                {
                  "name": "a",
                  "port": 2043,
                  "ip": "1.2.3.4",
                  "protocol": "telnet",
                  "entity_type": "Connection",
                  "created_time": "2019-06-02T15:35:05.165408Z",
                  "uuid": "febd391b-5fbd-4d29-bd7a-f0f2121c848d",
                  "deleted": false
                },
                {
                  "name": "b",
                  "port": 2044,
                  "ip": "1.2.3.4",
                  "protocol": "telnet",
                  "entity_type": "Connection",
                  "created_time": "2019-06-02T15:35:05.174043Z",
                  "uuid": "f8769c73-9872-4828-a7ad-9ae94bd91ec9",
                  "deleted": false
                }
              ],
              "platform": "n7000"
            }
          ],
          "created_by": "test_user",
          "deleted_at": null,
          "states": {
            "reservation": "AVAILABLE",
            "operation": "FREE",
            "configuration": "ENABLED"
          },
          "topology_name": "My-TOPO",
          "backend": "static"
        }
      ]
      

Retrieve Testbed

Return testbed information.

  • URL: /api/v1/testbeds/:uuid
  • Method: GET
  • Permission Required: No permission required. User needs to be a member of the group that owns the testbed.
  • Group: retrieved from headers
  • Success Response
    • Condition: If testbed exists and Authorized User is a member of the group.
    • Code: 200 OK
    • Response example:
      {
        "uuid": "24276d46-e652-4fd8-addc-1ad0830a6008",
        "topology": "8604a664-37b2-4850-a6fd-446197dea87b",
        "name": "My-Testbed",
        "description": null,
        "content": "<Raw Testbed YAML string>",
        "date_created": "2019-06-02T15:35:04.642772Z",
        "link_id": "c7b43224-ee38-4a33-9a1e-2a95c22c4a6f",
        "max_reservation_time": 86400,
        "max_retention_period": 43200,
        "site": "SITE",
        "bldg": "ALL",
        "reservation_disabled": false,
        "qmgr_reservation_id": null,
        "clean_instruction_id": "7cb5b816-df41-4d4f-8b01-579c64ccb99c",
        "clean_yaml": "<Raw Clean YAML string>",
        "tcl_conf": null,
        "tcl_control": null,
        "devices": [
          {
            "name": "P1",
            "source": 0,
            "uuid": "cfe9effb-938a-454b-a6fc-b4ec0a40d744",
            "description": null,
            "operational_state": "FREE",
            "deleted": false,
            "type": "router",
            "entity_type": "Device",
            "configuration_state": "ENABLED",
            "os": "nxos",
            "created_time": "2019-06-02T15:35:05.163101Z",
            "connections": [
              {
                "name": "a",
                "port": 2043,
                "ip": "1.2.3.4",
                "protocol": "telnet",
                "entity_type": "Connection",
                "created_time": "2019-06-02T15:35:05.165408Z",
                "uuid": "febd391b-5fbd-4d29-bd7a-f0f2121c848d",
                "deleted": false
              },
              {
                "name": "b",
                "port": 2044,
                "ip": "1.2.3.4",
                "protocol": "telnet",
                "entity_type": "Connection",
                "created_time": "2019-06-02T15:35:05.174043Z",
                "uuid": "f8769c73-9872-4828-a7ad-9ae94bd91ec9",
                "deleted": false
              }
            ],
            "platform": "n7000"
          }
        ],
        "created_by": "test_user",
        "deleted_at": null,
        "states": {
          "reservation": "AVAILABLE",
          "operation": "FREE",
          "configuration": "ENABLED"
        },
        "backend": "static",
        "topology_name": "My-TOPO",
        "reservations": []
      }
      
  • Error Response
    • Condition: If testbed does not exist with provided uuid
    • Code: 404 NOT FOUND
    • Response example: { detail: 'Not Found' }

Retrieve Testbed Clean Instructions

Return testbed clean instructions.

  • URL: /api/v1/testbeds/:uuid/cleans/:uuid
  • Method: GET
  • Permission Required: No permission required. User needs to be a member of the group that owns the testbed.
  • Group: retrieved from headers
  • Success Response
    • Condition: If testbed/clean exists and Authorized User is a member of the group.
    • Code: 200 OK
    • Response example:
      {
        "name": "My-Clean",
        "groups": [
          {
            "name": "nx_grp",
            "devices": ["P1"],
            "instruction": 32,
            "id": 13,
            "deleted": false
          }
        ],
        "enginefields": [],
        "image_loading_mechanism": "platform",
        "date_created": "2019-06-02T15:35:05.793851Z",
        "harnessfields": [],
        "yaml": "<Raw Clean YAML string>",
        "testbed": {
          "name": "My-N7K-Testbed",
          "uuid": "24276d46-e652-4fd8-addc-1ad0830a6008",
          "devices": [
            {
              "name": "P1",
              "images": [
                {
                  "uuid": "26c01192-b5a5-433e-b49c-20d33ea7747b",
                  "platform": "n7000",
                  "role": "kick",
                  "include": "",
                  "exclude": "",
                  "file": "ftp://xpresso.server/demo_images/n7k.kickstart.gbin",
                  "base_dir": "",
                  "cardinality": -1,
                  "deleted": false
                },
                {
                  "uuid": "6fdb080c-6ce5-4ad0-9679-44121201822c",
                  "platform": "n7000",
                  "role": "sys",
                  "include": "",
                  "exclude": "",
                  "file": "ftp://xpresso.com/demo_images/n7k.system.gbin",
                  "base_dir": "",
                  "cardinality": -1,
                  "deleted": false
                }
              ],
              "must_supply_new_image": false,
              "uuid": "cfe9effb-938a-454b-a6fc-b4ec0a40d744",
              "platform": {
                "name": "n7000",
                "date_created": "2019-04-15T20:17:28.210504Z",
                "lettercode": "",
                "series": "",
                "os": "nxos",
                "alias": "",
                "specs_id": 17,
                "created_by": "admin"
              },
              "instruction": 32,
              "should_clean_this_device": true
            }
          ],
          "deleted": false
        },
        "interest_lists": "",
        "config_state": "ENABLED",
        "priority": 4,
        "is_default": true,
        "uuid": "7cb5b816-df41-4d4f-8b01-579c64ccb99c",
        "envargs": [],
        "created_by": "test_user",
        "deleted": false,
        "max_run_time": 1800
      }
      
  • Error Response
    • Condition: If testbed/clean does not exist with provided testbed uuid or clean uuid
    • Code: 404 NOT FOUND
    • Response example: {}

Retrieve Topologies

Returns topologies defined under group.

  • URL: /api/v1/topologies
  • Method: GET
  • Permission Required: No permission required.
  • Group: retrieved from headers
  • Success Response
    • Condition: Authorized User.
    • Code: 200 OK
    • Response example:
      [
        {
          "uuid": "dcbc4e2c-6330-42a7-8793-4d8a43e16d39",
          "backend": "back",
          "name": "MyTopology",
          "description": "synced from back",
          "content": {
            "content": {
              "path": "Static Topologies/MyTopology",
              "image": "http://my.server.com:1234/images/e6acb9e9-9e11-43d8-89c1-4abf5c7145d4.jpg",
              "virl": "/some_dir/topologies/MyTopology/topology.virl",
              "image_file_name": "3c8a5868-2527-44d4-bed4-30e9079300e9.jpeg"
            }
          },
          "date_created": "2019-05-31T23:13:09.787665Z",
          "link_id": "3c8a5868-2527-44d4-bed4-30e9079300e9",
          "deleted_at": null,
          "manually_uploaded_image": false,
          "is_virtual": false
        }
      ]
      

Retrieve Topology

Return topology information.

  • URL: /api/v1/topologies/:uuid
  • Method: GET
  • Permission Required: No permission required. User needs to be a member of the group that owns the topology.
  • Group: retrieved from headers
  • Success Response
    • Condition: If topology exists and Authorized User is a member of the group.
    • Code: 200 OK
    • Response example:
      {
        "uuid": "dcbc4e2c-6330-42a7-8793-4d8a43e16d39",
        "backend": "laas",
        "name": "MyTopology",
        "description": "synced from laas",
        "content": {
          "content": {
            "path": "Static Topologies/MyTopology",
            "image": "http://my.server:1234/images/e6acb9e9-9e11-43d8-89c1-4abf5c7145d4.jpg",
            "virl": "/some_dir/topologies/MyTopology/topology.virl",
            "image_file_name": "3c8a5868-2527-44d4-bed4-30e9079300e9.jpeg"
          }
        },
        "date_created": "2019-05-31T23:13:09.787665Z",
        "link_id": "3c8a5868-2527-44d4-bed4-30e9079300e9",
        "deleted_at": null,
        "manually_uploaded_image": false,
        "is_virtual": false
      }
      
  • Error Response
    • Condition: If topology does not exist with provided uuid
    • Code: 404 NOT FOUND
    • Response example: {}