Running a Netperf Speed Test via NetCloud Manager API 2.0 - Running-a-Netperf-Speed-Test-via-NetCloud-Manager-API-2.0/Running-a-Netperf-Speed-Test-via-NetCloud-Manager-API-2.0

Running a Netperf Speed Test via NetCloud Manager API 2.0

ft:locale
en-US
ft:sourceName
Paligo_Prod
Document Type
Article

Use this document to understand how to run a Netperf speed test on the network devices in your account using the NetCloud Manager API 2.0 speed_test endpoint.

Prerequisites for running API 2.0 speed tests

The following are required to run speed tests via API 2.0.

  • A Rest client like Postman, Curl, Swagger UI, etc. Note that Swagger UI can be used for making API calls from the API 2.0 documentation page. Curl examples are used in this document.

  • A Netperf server. Ericsson Enterprise Wireless does not provide Netperf servers for API 2.0 speed tests. You must provide your own Netperf server and add the URL for the server to "host" field in the config object of the POST request.

  • Your account's ID. This value is used in URL form. Use either of the following methods to obtain this value.

    • Call the NCM API 2.0 accounts endpoint. Use the value of the "resource_url" field.

      {
        "account": "https://www.cradlepointecm.com/api/v2/accounts/308/",
        "id": "241",
        "is_disabled": false,
        "name": "cradlepoint",
        "resource_url": "https://www.cradlepointecm.com/api/v2/accounts/241/"
      }        
    • Find your account ID in your NCM profile profile.png after your username. Add that to the URL "https://www.cradlepointecm.com/api/v2/accounts/<your account number>/"

  • The ID(s) of the network devices being tested, passed in an array in the config object of the POST request. Your account's network device IDs can be found with either of the following methods.

    • Using the Devices > Network Interfaces page. The ID for each interface is shown in the ID column.

      Tip

      If the ID column isn't visible, click the Configure Columns button (columns.png) and toggle on the ID column.

    • Call the net_devices endpoint. Get the value of the "id" field for the interfaces being tested.

  • NCM API 2.0 keys. These are available from NetCloud Manager's Tools > NetCloud API page. These API keys are passed in the request header.

POST requests are used to create and start speed tests. The following Curl example shows a POST request to the speed_test endpoint that creates and starts a speed test on the network device with the ID 12345678.

curl -v -X POST -H "X-ECM-API-ID:$X_ECM_API_ID" -H "X-ECM-API-KEY:$X_ECM_API_KEY" -H "X-CP-API-ID:$X_CP_API_ID" -H "X-CP-API-KEY:$X_CP_API_KEY" -H "Content-Type:application/json" "https://www.cradlepointecm.com/api/v2/speed_test/" -d '{
        "account": "https://www.cradlepointecm.com/api/v2/accounts/1/",
          "config": {    
          "host": "YOURTESTSERVER.COM",
          "max_test_concurrency": 5,
          "net_device_ids": [
              12345678
          ],
          "port": 12865,
          "size": null,
          "test_timeout": 10,
          "test_type": "TCP Download",
          "time": 10
      }
    }

Response to successful POST request.

{
    "account": "https://www.cradlepointecm.com/api/v2/accounts/1/",
    "config": {
        "host": "YOURTESTSERVER.COM",
        "max_test_concurrency": 5,
        "net_device_ids": [
            12345678
        ],
        "port": 12865,
        "size": null,
        "test_timeout": 10,
        "test_type": "TCP Download",
        "time": 10
    },
    "created_at": "2019-02-06T15:16:16.240612+00:00",
    "id": "47535",
    "progress": null,
    "resource_uri": "https://www.cradlepointecm.com/api/v2/speed_test/47535/",
    "results": null,
    "state": "created",
    "updated_at": "2019-02-06T15:16:16.240636+00:00"
}

To check the status of a speed test, use the ID of the speed test in a GET request to the speed_test endpoint.

curl -v -X GET -H "X-ECM-API-ID:$X_ECM_API_ID" -H "X-ECM-API-KEY:$X_ECM_API_KEY" -H "X-CP-API-ID:$X_CP_API_ID" -H "X-CP-API-KEY:$X_CP_API_KEY" "https://www.cradlepointecm.com/api/v2/speed_test/47535/"

The response to this request contains the "progress" and "results" objects containing the status and results of the speed test.

{
  "account": "https://www.cradlepointecm.com/api/v2/accounts/1/", 
  "config": {
    "host": "YOURTESTSERVER.COM",
    "max_test_concurrency": 5,
    "net_device_ids": [
      12345678
    ],
    "port": 12865,
    "size": null,
    "test_timeout": 10,
    "test_type": "TCP Download",
    "time": 10
  },
  "created_at": "2019-02-06T15:16:16.240612+00:00",
  "id": "47535",
  "progress": {
    "completed": 1,
    "total_count": 1
  },
  "resource_uri": "https://www.cradlepointecm.com/api/v2/speed_test/47535/",
  "results": [
    {
      "created_at": "2019-02-06 15:16:16.260749+00:00",
      "net_device_id": 12345678,
      "results": "TCP Download Test Timestamp: 2019-02-18 16:14:56 Duration: 10.01 Seconds Client Received: 69.6 MB Client Sent: 0 bytesServer Received: 0 bytes Server Sent: 70.4 MB Download Throughput: 58.34 Mbps",
      "router_id": 123456,
      "state": "success",
      "updated_at": "2019-02-06 15:16:19.573507+00:00"
    }
  ],
  "state": "complete",
  "updated_at": "2019-02-06T15:17:16.362784+00:00"
}