ves-io-schema-virtual_network-CustomDataAPI-SIDCounters

Examples of performing virtual_network CustomDataAPI SIDCounters

Usecase:

Get SID Counters

Request:

Request using vesctl:

vesctl request rpc virtual_network.CustomDataAPI.SIDCounters -i request.yaml --uri /public/namespaces/system/virtual_network/sid_counters --http-method POST

where file request.yaml has following contents:

endTime: "1593622800"
fieldSelector:
- SID_COUNTER_IN_PACKETS
- SID_COUNTER_OUT_PACKETS
filter: '{SITE="site-1"}'
groupBy:
- VIRTUAL_NETWORK
- SID_PREFIX
namespace: system
startTime: "1593619200"

vesctl yaml response:

data:
- data:
  - key:
      SID_PREFIX: 2001:f00f:18a:6001:b::/128
      VIRTUAL_NETWORK: virtual-network-1
    value:
    - timestamp: 1593622800
      value: "1024"
  - key:
      SID_PREFIX: 2004:f00f:18a:3001:e::/80
      VIRTUAL_NETWORK: virtual-network-2
    value:
    - timestamp: 1593622800
      value: "1024"
  type: SID_COUNTER_IN_PACKETS
- data:
  - key:
      SID_PREFIX: 2001:f00f:18a:6001:b::/128
      VIRTUAL_NETWORK: virtual-network-1
    value:
    - timestamp: 1593622800
      value: "10"
  - key:
      SID_PREFIX: 2004:f00f:18a:3001:e::/80
      VIRTUAL_NETWORK: virtual-network-2
    value:
    - timestamp: 1593622800
      value: "100"
  type: SID_COUNTER_OUT_PACKETS

Request using curl:

curl -X 'POST' -d '{"namespace":"system","filter":"{SITE="site-1"}","groupBy":["VIRTUAL_NETWORK","SID_PREFIX"],"fieldSelector":["SID_COUNTER_IN_PACKETS","SID_COUNTER_OUT_PACKETS"],"startTime":"1593619200","endTime":"1593622800"}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build970361017_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/data/namespaces/system/virtual_network/sid_counters'

curl response:

HTTP/1.1 200 OK
Content-Length: 1326
Content-Type: application/json
Date: Wed, 25 Aug 2021 09:04:39 GMT
Vary: Accept-Encoding

{
  "data": [
    {
      "type": "SID_COUNTER_IN_PACKETS",
      "data": [
        {
          "key": {
            "SID_PREFIX": "2001:f00f:18a:6001:b::/128",
            "VIRTUAL_NETWORK": "virtual-network-1"
          },
          "value": [
            {
              "timestamp": 1593622800,
              "value": "1024"
            }
          ]
        },
        {
          "key": {
            "SID_PREFIX": "2004:f00f:18a:3001:e::/80",
            "VIRTUAL_NETWORK": "virtual-network-2"
          },
          "value": [
            {
              "timestamp": 1593622800,
              "value": "1024"
            }
          ]
        }
      ]
    },
    {
      "type": "SID_COUNTER_OUT_PACKETS",
      "data": [
        {
          "key": {
            "SID_PREFIX": "2001:f00f:18a:6001:b::/128",
            "VIRTUAL_NETWORK": "virtual-network-1"
          },
          "value": [
            {
              "timestamp": 1593622800,
              "value": "10"
            }
          ]
        },
        {
          "key": {
            "SID_PREFIX": "2004:f00f:18a:3001:e::/80",
            "VIRTUAL_NETWORK": "virtual-network-2"
          },
          "value": [
            {
              "timestamp": 1593622800,
              "value": "100"
            }
          ]
        }
      ]
    }
  ]
}