Product
Search Results

Packages

List packages

Get a list of packages.

GET /api/v1/packages/{?page,limit,filter,sort}

URL Parameters

Name Description
page integer (optional) See Paging
limit integer (optional) See Paging
detailed boolean (optional) See Summary / Detailed Representations
filter string (optional) See Filtering
sort string (optional) See Sorting

Response 200 OK

{
    "timestamp": "2016-04-14T10:19:13.039004889-04:00",
    "data": [
        {
            "id": "82",
            "name": "HTTP_download",
            "description": "QA Cafe regression tests, test run 1",
            "created": "0000-12-31T19:03:58-04:56",
            "updated": "2016-04-13T11:15:33.028128-04:00",
            "locked": false,
            "test_count": "3",
            "user_id": "1",
            "config_id": "0",
            "device_id": "12",
            "tags": [],
            "use_as_testlist": false,
            "schedule": {
                "enabled": true,
                "spec": "30 17 * * *",
                "options": {
                    "tags": [],
                    "skip_tests": [],
                    "begin_at": "",
                    "end_at": "",
                    "extra_cli_args": ""
                }
            }
        },
        {
            "id": "172",
            "name": "RV220W",
            "description": "VPN TEST",
            "created": "0000-12-31T19:03:58-04:56",
            "updated": "2016-04-13T11:15:33.030267-04:00",
            "locked": false,
            "test_count": "1",
            "user_id": "1",
            "config_id": "0",
            "device_id": "10",
            "tags": [
                "CDRouter",
                "Support"
            ],
            "use_as_testlist": false,
            "schedule": {
                "enabled": false,
                "spec": "",
                "options": {
                    "tags": [],
                    "skip_tests": [],
                    "begin_at": "",
                    "end_at": "",
                    "extra_cli_args": ""
                }
            }
        }
    ],
    "links": {
        "current": 1,
        "first": 1,
        "last": 14,
        "limit": 10,
        "next": 2,
        "total": 133
    }
}

Get a package

Get a package.

GET /api/v1/packages/{id}/

Response 200 OK

{
    "timestamp": "2016-04-14T10:22:42.598320818-04:00",
    "data": {
        "id": "5",
        "name": "basic",
        "description": "",
        "created": "2015-11-17T10:34:23.297556-05:00",
        "updated": "2016-04-13T11:15:33.040246-04:00",
        "locked": false,
        "test_count": "101",
        "testlist": [
            "ADDON_SNMP",
            "MODULE_snmp-v6.tcl",
            "ipv6_snmp_200",
            "MODULE_basic.tcl",
            "ipv6_snmp_103"
        ],
        "extra_cli_args": "",
        "user_id": "1",
        "agent_id": "1",
        "config_id": "6",
        "device_id": "12",
        "options": {
            "forever": false,
            "loop": "0",
            "repeat": "0",
            "maxfail": "0",
            "duration": "0",
            "duration_units": "seconds",
            "duration_interrupt": false,
            "duration_no_error": false,
            "wait": "0",
            "pause": false,
            "shuffle": false,
            "seed": "0",
            "retry": "0",
            "rdelay": "0",
            "sync": false
        },
        "tags": [
            "one",
            "two",
            "three"
        ],
        "use_as_testlist": false,
        "schedule": {
            "enabled": true,
            "spec": "30 17 * * *",
            "options": {
                "tags": [],
                "skip_tests": [],
                "begin_at": "",
                "end_at": "",
                "extra_cli_args": ""
            }
        },
        "interfaces": [
                {
                        "name": "lan",
                        "value": "eth1",
                        "is_wireless": false,
                        "is_ics": false
                },
                {
                        "name": "wan",
                        "value": "eth2",
                        "is_wireless": false,
                        "is_ics": false
                }
        ]
    }
}

Response 404 Not Found

{
    "error": "no such package"
}

Create a package

Create a new package.

POST /api/v1/packages/

Example

{
    "agent_id": "1",
    "test_count": "517",
    "testlist": [
        "MODULE_basic.tcl",
        "cdrouter_dhcp_server_1",
        "cdrouter_dhcp_server_2",
        "cdrouter_dhcp_server_3",
        "cdrouter_dhcp_server_100",
        "cdrouter_dhcp_server_200",
        "cdrouter_dhcp_server_300",
        "ADDON_IPv6"
    ],
    "user_id": "1",
    "name": "new package",
    "config_id": "6",
    "device_id": "12",
    "description": "package description",
    "tags": [
        "one",
        "two",
        "three"
    ],
    "options": {
        "pause": true,
        "duration": "300",
        "retry": "5"
    },
    "use_as_testlist": false,
    "schedule": {
        "enabled": true,
        "spec": "30 17 * * *",
        "options": {
            "tags": [],
            "skip_tests": [],
            "begin_at": "",
            "end_at": "",
            "extra_cli_args": ""
        }
    }
}

Response 200 OK

{
    "timestamp": "2016-04-15T09:11:30.136008699-04:00",
    "data": {
        "id": "1050",
        "name": "new package",
        "description": "package description",
        "created": "2016-04-15T09:11:30.107517222-04:00",
        "updated": "2016-04-15T09:11:30.107517222-04:00",
        "locked": false,
        "test_count": "517",
        "testlist": [
            "MODULE_basic.tcl",
            "cdrouter_dhcp_server_1",
            "cdrouter_dhcp_server_2",
            "cdrouter_dhcp_server_3",
            "cdrouter_dhcp_server_100",
            "cdrouter_dhcp_server_200",
            "cdrouter_dhcp_server_300",
            "ADDON_IPv6"
        ],
        "extra_cli_args": "",
        "user_id": "1",
        "agent_id": "1",
        "config_id": "6",
        "device_id": "12",
        "options": {
            "forever": false,
            "loop": "0",
            "repeat": "0",
            "maxfail": "0",
            "duration": "300",
            "duration_units": "seconds",
            "duration_interrupt": false,
            "duration_no_error": false,
            "wait": "0",
            "pause": true,
            "shuffle": false,
            "seed": "0",
            "retry": "5",
            "rdelay": "0",
            "sync": false
        },
        "tags": [
            "one",
            "three",
            "two"
        ],
        "use_as_testlist": false,
        "schedule": {
            "enabled": true,
            "spec": "30 17 * * *",
            "options": {
                "tags": [],
                "skip_tests": [],
                "begin_at": "",
                "end_at": "",
                "extra_cli_args": ""
            }
        },
        "interfaces": [
                {
                        "name": "lan",
                        "value": "eth1",
                        "is_wireless": false,
                        "is_ics": false
                },
                {
                        "name": "wan",
                        "value": "eth2",
                        "is_wireless": false,
                        "is_ics": false
                }
        ]
    }
}

Edit a package

Edit a package.

PATCH /api/v1/packages/{id}/

Example

PATCH /api/v1/packages/123/
{
    "id": "123",
    "name": "all",
    "description": "abcd",
    "testlist": [
        "ADDON_CDRouter",
        "ADDON_Multiport",
        "ADDON_TR-069",
        "ADDON_BBF.069",
        "ADDON_IKE",
        "ADDON_IPv6",
        "ADDON_Storage",
        "ADDON_SNMP",
        "ADDON_Nmap",
        "ADDON_Performance"
    ],
    "extra_cli_args": "",
    "user_id": "1",
    "config_id": "6",
    "device_id": "10",
    "options": {
        "forever": false,
        "loop": "0",
        "repeat": "0",
        "maxfail": "0",
        "duration": "0",
        "duration_units": "seconds",
        "duration_interrupt": false,
        "duration_no_error": false,
        "wait": "0",
        "pause": false,
        "shuffle": false,
        "seed": "0",
        "retry": "0",
        "rdelay": "0",
        "sync": false
    },
    "tags": [
        "one",
        "two",
        "three"
    ],
    "use_as_testlist": true,
    "schedule": {
        "enabled": true,
        "spec": "30 17 * * *",
        "options": {
            "tags": [],
            "skip_tests": [],
            "begin_at": "",
            "end_at": "",
            "extra_cli_args": ""
        }
    }
}

Response 200 OK

{
    "timestamp": "2016-04-15T09:11:30.136008699-04:00",
    "data": {
        "id": "123",
        "name": "all",
        "description": "abcd",
        "created": "2016-03-02T14:27:50.700837-05:00",
        "updated": "2016-04-13T11:15:33.035754-04:00",
        "locked": false,
        "test_count": "4040",
        "testlist": [
            "ADDON_CDRouter",
            "ADDON_Multiport",
            "ADDON_TR-069",
            "ADDON_BBF.069",
            "ADDON_IKE",
            "ADDON_IPv6",
            "ADDON_Storage",
            "ADDON_SNMP",
            "ADDON_Nmap",
            "ADDON_Performance"
        ],
        "extra_cli_args": "",
        "user_id": "1",
        "agent_id": "1",
        "config_id": "6",
        "device_id": "10",
        "options": {
            "forever": false,
            "loop": "0",
            "repeat": "0",
            "maxfail": "0",
            "duration": "0",
            "duration_units": "seconds",
            "duration_interrupt": false,
            "duration_no_error": false,
            "wait": "0",
            "pause": false,
            "shuffle": false,
            "seed": "0",
            "retry": "0",
            "rdelay": "0",
            "sync": false
        },
        "tags": [
            "one",
            "two",
            "three"
        ],
        "use_as_testlist": true,
        "schedule": {
            "enabled": true,
            "spec": "30 17 * * *",
            "options": {
                "tags": [],
                "skip_tests": [],
                "begin_at": "",
                "end_at": "",
                "extra_cli_args": ""
            }
        },
        "interfaces": [
                {
                        "name": "lan",
                        "value": "eth1",
                        "is_wireless": false,
                        "is_ics": false
                },
                {
                        "name": "wan",
                        "value": "eth2",
                        "is_wireless": false,
                        "is_ics": false
                }
        ]
    }
}

Delete a package

Delete a package.

DELETE /api/v1/packages/{id}/

Response 204 No Content

Lock a package

Lock a package. Locking a package prevents it from being modified or deleted until it is unlocked.

POST /api/v1/packages/{id}/lock

Response 200 OK

{
  "timestamp": "2023-03-29T15:44:56.344988954-04:00",
  "data": {
    "id": "66",
    "name": "delme1",
    "description": "",
    "created": "2021-09-21T09:43:36.849352-04:00",
    "updated": "2023-03-28T11:09:01.659284-04:00",
    "locked": true,
    "test_count": "0",
    "testlist": [],
    "extra_cli_args": "",
    "user_id": "1",
    "agent_id": "1",
    "config_id": "0",
    "device_id": "0",
    "options": {
      "forever": true,
      "loop": "0",
      "repeat": "3",
      "maxfail": "0",
      "duration": "0",
      "duration_units": "seconds",
      "duration_interrupt": false,
      "duration_no_error": false,
      "wait": "0",
      "pause": false,
      "shuffle": false,
      "seed": "0",
      "retry": "0",
      "rdelay": "0",
      "sync": false
    },
    "tags": [
      "foo"
    ],
    "use_as_testlist": false,
    "note": "",
    "schedule": {
      "enabled": false,
      "spec": "0 0 * * *",
      "options": {
        "tags": null,
        "skip_tests": null,
        "begin_at": "",
        "end_at": "",
        "extra_cli_args": ""
      }
    }
  }
}

Unlock a package

Unlock a package. Unlocking a locked package allows it to be modified or deleted once again.

POST /api/v1/packages/{id}/unlock

Response 200 OK

{
  "timestamp": "2023-03-29T15:44:56.344988954-04:00",
  "data": {
    "id": "66",
    "name": "delme1",
    "description": "",
    "created": "2021-09-21T09:43:36.849352-04:00",
    "updated": "2023-03-28T11:09:01.659284-04:00",
    "locked": false,
    "test_count": "0",
    "testlist": [],
    "extra_cli_args": "",
    "user_id": "1",
    "agent_id": "1",
    "config_id": "0",
    "device_id": "0",
    "options": {
      "forever": true,
      "loop": "0",
      "repeat": "3",
      "maxfail": "0",
      "duration": "0",
      "duration_units": "seconds",
      "duration_interrupt": false,
      "duration_no_error": false,
      "wait": "0",
      "pause": false,
      "shuffle": false,
      "seed": "0",
      "retry": "0",
      "rdelay": "0",
      "sync": false
    },
    "tags": [
      "foo"
    ],
    "use_as_testlist": false,
    "note": "",
    "schedule": {
      "enabled": false,
      "spec": "0 0 * * *",
      "options": {
        "tags": null,
        "skip_tests": null,
        "begin_at": "",
        "end_at": "",
        "extra_cli_args": ""
      }
    }
  }
}

Get a package’s shares

Get shares for a package.

GET /api/v1/packages/{id}/shares

Response 200 OK

{
    "timestamp": "2016-04-15T10:00:22.32676552-04:00",
    "data": [
        {
            "user_id": "307",
            "read": true,
            "write": false,
            "execute": false
        },
        {
            "user_id": "309",
            "read": true,
            "write": false,
            "execute": false
        }
    ]
}

Edit a package’s shares

Edit shares for a package.

PATCH /api/v1/packages/{id}/shares

Example

PATCH /api/v1/packages/123/shares
{
    "user_ids": [
        309,
        307
    ]
}

Response 200 OK

{
    "timestamp": "2016-04-15T10:00:22.32676552-04:00",
    "data": [
        {
            "user_id": "309",
            "read": true,
            "write": false,
            "execute": false
        },
        {
            "user_id": "307",
            "read": true,
            "write": false,
            "execute": false
        }
    ]
}

Get a package’s expanded testlist

Get the testlist for a package, with all addons, modules and testlists expanded.

POST /api/v1/packages/{id}/?process=testlist-expanded

Response 200 OK

{
    "timestamp": "2016-04-15T10:00:22.32676552-04:00",
    "data": [
        "cdrouter_basic_1",
        "cdrouter_basic_2",
        "cdrouter_nat_1",
        "cdrouter_nat_100"
    ]
}

Get a package’s interfaces

Process a package with cdrouter-cli -print-interfaces.

POST /api/v1/packages/?process=interfaces

Example

POST /api/v1/packages/?process=interfaces
{
    "config_id": "58",
    "extra_cli_args": "-testvar lanInterface=eth2"
}

Response 200 OK

{
    "timestamp": "2022-02-14T10:37:07.88200925-05:00",
    "data": [
        {
            "name": "lan",
            "value": "eth2",
            "is_wireless": false,
            "is_ics": false
        },
        {
            "name": "wan",
            "value": "wifi0",
            "is_wireless": true,
            "is_ics": false
        }
    ]
}

Export a package

Export a package.

GET /api/v1/packages/{id}/?format=gz

Response 200 OK

Content-Type: application/x-gzip
Content-Disposition: inline; filename="{name}.gz"

Analyze a package

Get a list of tests that will be skipped for a package.

POST /api/v1/packages/{id}/?process=analyze

Response 200 OK

{
    "timestamp": "2016-04-15T09:55:02.225208264-04:00",
    "data": {
        "total_count": 51,
        "run_count": 23,
        "skipped_count": 3,
        "skipped_tests": [
            {
                "id": 1,
                "name": "cdrouter_basic_10",
                "index": 2,
                "group": "CDRouter",
                "module": "basic.tcl",
                "synopsis": "Verify LAN DHCP clients receive gateway/DNS configuration from WAN side",
                "description": "\n\n    step 1. Start new DHCP client on LAN interface\n    step 2. Verify the received DHCP options match the WAN configuration\n    step 3. Verify network mask matches configured network mask\n    step 4. Verify gateway is router's LAN IP address\n    step 5. Verify DNS server is one of the following values:\n\n            a. WAN ISP DNS server, if the testvar DNStoDHCP is set to 'yes'\n            b. user defined DNS server if the testvar lanDnsServer is enabled\n            c. the router's LAN IP if the testvar DNStoDHCP is set to 'no'\n               and the testvar lanDnsServer is disabled\n\n    step 6. If the WAN is running DHCP, verify domain is WAN ISP domain name\n\n",
                "labels": [
                    "all",
                    "incompatible-with-internal-dhcp",
                    "requires-additional-lan-client",
                    "requires-ipv4",
                    "requires-lan-interface"
                ],
                "testvars": [
                    "DNStoDHCP",
                    "lanDnsServer",
                    "wanDnsServer",
                    "wanDomainName",
                    "wanMode"
                ],
                "skip_name": "incompatible-with-internal-dhcp",
                "skip_reason": "Skipping tests that are not compatible with static IPv4 addressing on the LAN"
            },
            {
                "id": 1,
                "name": "cdrouter_basic_20",
                "index": 3,
                "group": "CDRouter",
                "module": "basic.tcl",
                "synopsis": "Outbound packets use specified/cloned source MAC address",
                "description": "\n\n    step 1. Send an ICMP Echo Request from the LAN to the remote host IPv4\n    step 2. Verify that an ICMP Echo Request is received on the WAN\n    step 3. Verify that the source MAC address in the ICMP Echo Request received\n            on the WAN matches the expected MAC address of DUT's WAN interface\n\n    NOTE: This test is skipped for wanMode PPPoA.\n\n    NOTE: To configure the expected MAC address of the DUT's WAN interface,\n    configure the testvar \"wanDutMac\". If this testvar is not defined, this test\n    case will be skipped.\n\n",
                "labels": [
                    "all",
                    "incompatible-with-pppoa-wan",
                    "requires-ipv4",
                    "requires-lan-interface",
                    "requires-wan-dut-mac"
                ],
                "testvars": [
                    "wanDutMac"
                ],
                "skip_name": "requires-wan-dut-mac",
                "skip_reason": "Skipping MAC clone test case (wanDutMac not defined)"
            },
            {
                "id": 1,
                "name": "cdrouter_app_10",
                "index": 163,
                "group": "CDRouter",
                "module": "apps.tcl",
                "synopsis": "Connections opened for FTP PORT command check for correct IPv4 address",
                "description": "\n\n    step 1. Initiate an outbound FTP connection to FTP server port\n    step 2. Verify the connection is established\n    step 3. Send the FTP port command\n    step 4. Verify router translates port command using router's address\n    step 5. From new host, attempt inbound TCP connection for FTP data connection\n    step 6. Verify inbound TCP connection is not established\n    step 7. Close both connections\n\n",
                "labels": [
                    "all",
                    "requires-additional-wan-public-ip",
                    "requires-forwarding",
                    "requires-ipv4",
                    "requires-lan-interface"
                ],
                "testvars": [],
                "skip_name": "requires-forwarding",
                "skip_reason": "Skipping tests and modules not compatible with bridge configuration"
            }
        ]
    }
}

Bulk export packages

Bulk export a set of packages.

GET /api/v1/packages/{?bulk=export,ids}

URL Parameters

Name Description
bulk string (required) Must be export
ids string (required) Comma-separated package IDs to export

Example

GET /api/v1/packages/?bulk=export&ids=123,456,789

Response 200 OK

Content-Type: application/x-gzip
Content-Disposition: inline; filename="packages-{timestamp}.gz"

Bulk copy packages

Bulk copy a set of packages.

POST /api/v1/packages/?bulk=copy

Example

POST /api/v1/packages/?bulk=copy
{
    "packages": [
        {"id": "286"},
        {"id": "5"}
    ]
}

Response 200 OK

Returns packages array containing new packages copied from input IDs.

{
    "timestamp": "2016-04-15T09:25:34.483085665-04:00",
    "data": [
        {
            "id": "1051",
            "name": "all (copy 1)",
            "description": "",
            "created": "2016-03-02T14:27:50.700837-05:00",
            "updated": "2016-04-13T11:15:33.035754-04:00",
            "locked": false,
            "test_count": "4040",
            "testlist": [
                "ADDON_CDRouter",
                "ADDON_Multiport",
                "ADDON_TR-069",
                "ADDON_BBF.069",
                "ADDON_IKE",
                "ADDON_IPv6",
                "ADDON_Storage",
                "ADDON_SNMP",
                "ADDON_Nmap",
                "ADDON_Performance"
            ],
            "extra_cli_args": "",
            "user_id": "1",
            "agent_id": "1",
            "config_id": "6",
            "device_id": "12",
            "options": {
                "forever": false,
                "loop": "0",
                "repeat": "0",
                "maxfail": "0",
                "duration": "0",
                "duration_units": "seconds",
                "duration_interrupt": false,
                "duration_no_error": false,
                "wait": "0",
                "pause": false,
                "shuffle": false,
                "seed": "0",
                "retry": "0",
                "rdelay": "0",
                "sync": false
            },
            "tags": [],
            "use_as_testlist": false
        },
        {
            "id": "1052",
            "name": "basic (copy 1)",
            "description": "",
            "created": "2015-11-17T10:34:23.297556-05:00",
            "updated": "2016-04-13T11:15:33.040246-04:00",
            "locked": false,
            "test_count": "101",
            "testlist": [
                "ADDON_SNMP",
                "MODULE_snmp-v6.tcl",
                "ipv6_snmp_200",
                "MODULE_basic.tcl",
                "ipv6_snmp_103"
            ],
            "extra_cli_args": "",
            "user_id": "1",
            "agent_id": "1",
            "config_id": "6",
            "device_id": "12",
            "options": {
                "forever": false,
                "loop": "0",
                "repeat": "0",
                "maxfail": "0",
                "duration": "0",
                "duration_units": "seconds",
                "duration_interrupt": false,
                "duration_no_error": false,
                "wait": "0",
                "pause": false,
                "shuffle": false,
                "seed": "0",
                "retry": "0",
                "rdelay": "0",
                "sync": false
            },
            "tags": [],
            "use_as_testlist": false,
            "schedule": {
                "enabled": true,
                "spec": "30 17 * * *",
                "options": {
                    "tags": [],
                    "skip_tests": [],
                    "begin_at": "",
                    "end_at": "",
                    "extra_cli_args": ""
                }
            },
            "interfaces": [
                    {
                            "name": "lan",
                            "value": "eth1",
                            "is_wireless": false,
                            "is_ics": false
                    },
                    {
                            "name": "wan",
                            "value": "eth2",
                            "is_wireless": false,
                            "is_ics": false
                    }
            ]
        }
    ]
}

Bulk edit packages

Bulk edit a set of packages.

POST /api/v1/packages/{?bulk=edit,filter,all}

URL Parameters

Name Description
bulk string (required) Must be edit
filter string (optional) See Filtering
all boolean (optional) If true, apply edits to all packages.

Example

Bulk edit packages 5 and 286, setting their user_id field to 3, config_id field to 12, device_id field to 17, and tags field to ["foo", "bar", "baz"].

POST /api/v1/packages/?bulk=edit
{
    "packages": [
        {"id": "5"},
        {"id": "286"}
    ],
    "fields": {
        "user_id": "3",
        "config_id": "12",
        "device_id": "17",
        "tags": [
            "foo",
            "bar",
            "baz"
        ]
    }
}

Bulk edit packages matching filters user_id=3 and test_count=1, setting their tags field to ["one"].

POST /api/v1/packages/?bulk=edit&filter=user_id=3&filter=test_count=1
{
    "fields": {
        "tags": [
            "one"
        ]
    }
}

Bulk edit all packages, setting their user_id field to 3.

POST /api/v1/packages/?bulk=edit&all=true
{
    "fields": {
        "user_id": "3"
    }
}

Response 204 No Content

Bulk delete packages

Bulk delete a set of packages.

POST /api/v1/packages/{?bulk=delete,filter,all}

URL Parameters

Name Description
bulk string (required) Must be delete
filter string (optional) See Filtering
all boolean (optional) If true, delete all packages.

Example

Bulk delete packages 5 and 286.

POST /api/v1/packages/?bulk=delete
{
    "packages": [
        {"id": "5"},
        {"id": "286"}
    ]
}

Bulk delete packages matching filters user_id=3 and test_count=1.

POST /api/v1/packages/?bulk=delete&filter=user_id=3&filter=test_count=1

Bulk delete all packages.

POST /api/v1/packages/?bulk=delete&all=true

Response 204 No Content