Network Traffic Control

You may limit the bandwidth to any IP over any Interface using Network Traffic Control with your Atlas System.

Basic Operations

The Basic operations for network traffic control are listing controls, creating a control, and destroying a control.

List Network Traffic Controls

The network traffic controls can be listed by calling the following route.

Request Object

+ URL
  /api/v2/network/traffic/control

+ Method
  GET

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

Requesting the list of traffic controls returns a long list. Queues of type 'htb' are under traffic control.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {
    "devices": {
      "lo": {
        "queue": [
          {
            "qtype": "noqueue",
            "handler": 0,
            "device": "lo",
            "owner": "root",
            "refcnt": "2"
          }
        ],
        "class": [],
        "filter": []
      },
      "mgmt0": {
        "queue": [
          {
            "qtype": "mq",
            "handler": 0,
            "device": "mgmt0",
            "owner": "root"
          },
          {
            "qtype": "pfifo_fast",
            "handler": 0,
            "device": "mgmt0",
            "owner": "parent",
            "refcnt": "bands",
            "details": {
              "bands": "priomap",
              "priomap": "2,2,2,1,2,0,0,1,1,1,1,1,1,1,1,"
            }
          }
        ],
        "class": [],
        "filter": []
      },
      "mgmt1": {
        "queue": [
          {
            "qtype": "mq",
            "handler": 0,
            "device": "mgmt1",
            "owner": "root"
          }
        ],
        "class": [],
        "filter": []
      },
      "qsfp06p0": {
        "queue": [
          {
            "qtype": "mq",
            "handler": 0,
            "device": "qsfp06p0",
            "owner": "root"
          },
          {
            "qtype": "pfifo_fast",
            "handler": 0,
            "device": "qsfp06p0",
            "owner": "parent",
            "refcnt": "bands",
            "details": {
              "bands": "priomap",
              "priomap": "2,2,2,1,2,0,0,1,1,1,1,1,1,1,1,"
            }
          }
        ],
        "class": [],
        "filter": []
      },
      "qsfp06p1": {
        "queue": [
          {
            "qtype": "mq",
            "handler": 0,
            "device": "qsfp06p1",
            "owner": "root"
          },
          {
            "qtype": "pfifo_fast",
            "handler": 0,
            "device": "qsfp06p1",
            "owner": "parent",
            "refcnt": "bands",
            "details": {
              "bands": "priomap",
              "priomap": "2,2,2,1,2,0,0,1,1,1,1,1,1,1,1,"
            }
          }
        ],
        "class": [],
        "filter": []
      },
      "qsfp84p0": {
        "queue": [
          {
            "qtype": "mq",
            "handler": 0,
            "device": "qsfp84p0",
            "owner": "root"
          },
          {
            "qtype": "pfifo_fast",
            "handler": 0,
            "device": "qsfp84p0",
            "owner": "parent",
            "refcnt": "bands",
            "details": {
              "bands": "priomap",
              "priomap": "2,2,2,1,2,0,0,1,1,1,1,1,1,1,1,"
            }
          }
        ],
        "class": [],
        "filter": []
      },
      "bond0": {
        "queue": [
          {
            "qtype": "htb",
            "handler": 1,
            "device": "bond0",
            "owner": "root",
            "refcnt": "17",
            "details": {
              "r2q": "10",
              "default": "0",
              "direct_packets_stat": "6",
              "direct_qlen": "1000"
            }
          }
        ],
        "class": [],
        "filter": []
      }
    },
    "rules": [
      {
          "name": "test1",
          "qtype": "htb",
          "handler": 1,
          "device": "bond0",
          "owner": "root",
          "refcnt": "17",
          "queue_details": {
              "r2q": "10",
              "default": "0",
              "direct_packets_stat": "6",
              "direct_qlen": "1000"
          }
      }
    ],
    "ids": [
      "!!An_id_of_zero_is_illegal_please_never_remove_this_entry!!",
      "test1"
    ]
  }

Create a Network Traffic Control

The network traffic controls can be created by calling the following route.

Request Object

+ URL
  /api/v2/network/traffic/control/create

+ Method
  POST

+ Parameters
  name (string, required, Body) - the name to give this rule
  device (string, required, Body) - the name of the network interface to enforce traffic upon
  ip (string, required, Body) - the IP we should enforce traffic upon
  rate (number, required, Body) - the rate in MegaBytes that we should enforce the limit at

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "name": "testingRule",
    "device": "bond0",
    "ip": "192.168.7.60",
    "rate": 200
  }

Response Object

Requesting this will return to you the settings used to create the traffic control rule.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {
    "error": null,
    "name": "testingRule",
    "device": "bond0",
    "ip": "192.168.7.60",
    "rate": 200
  }

Destroy a Network Traffic Control

The network traffic controls can be destroyed by calling the following route.

Request Object

+ URL
  /api/v2/network/traffic/control/$RULE_NAME/destroy

+ Method
  POST

+ Parameters
  rule name (string, required, URL param) - the name of this rule

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "name": "testingRule"
  }

Response Object

Requesting this will return to you id the rule formerly occupied.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {
    "id": 2
  }