Skip to main content

Preview packet template frames

POST
/packet-constructor/preview

Compiles the packet template and returns a program summary and frames start..start+count-1: hex bytes and the values of all fields, decoded from the generated bytes. The generator sends exactly these frames. If sources (and targets) are provided, fields in the fromSource and fromTarget modes take their values from the source port with number port, and the response includes the port list; without them, such fields keep their defaults and are listed in info.unboundFields. Nothing is saved. Template errors are returned as a list in data.issues with paths to the fields.

Contract

Parameter
Value
Sectionpacket-constructor
AuthenticationCookieAuth
Consumesapplication/json
Producesapplication/json

Parameters

1 parameter

Name
Location
Required
Type
Description
requestbodyyesobjectTemplate, the first frame number (start), and the number of frames (count; default 16, at most 1000)
  • {
      "count": 0,
      "port": 0,
      "sources": [
        {
          "agent": {
            "id": 0
          },
          "data": [
            {
              "accessGroupId": 0,
              "accessPorts": "<string>",
              "effectiveL2Policy": {},
              "interface": "<string>",
              "l2PolicySource": "network",
              "l2PolicyVersion": 0,
              "mac": {},
              "network": {},
              "networkSource": "<string>",
              "randomMac": true,
              "weight": 0
            }
          ]
        }
      ],
      "start": 0,
      "targets": [
        {
          "accessGroupId": 0,
          "accessPorts": "<string>",
          "dstMacMode": "<string>",
          "effectiveL2Policy": {
            "dstMacMode": "<string>",
            "gatewayMac": "<string>",
            "innerL2Policy": [
              0
            ],
            "outerL2Policy": [
              0
            ],
            "pcapL2Precedence": "<string>",
            "sourceMacOverrides": [
              {}
            ],
            "sourceMacPolicy": {},
            "targetMacOverrides": [
              {}
            ],
            "targetMacPolicy": {}
          },
          "gatewayMac": {
            "id": 0
          },
          "l2PolicySource": "network",
          "l2PolicyVersion": 0,
          "mac": {
            "id": 0
          },
          "network": {
            "id": 0
          },
          "networkSource": "<string>",
          "randomMac": true,
          "weight": 0
        }
      ],
      "template": {
        "frameSize": {
          "entries": [
            {}
          ],
          "max": 0,
          "min": 0,
          "mode": "<string>",
          "preset": "<string>",
          "seed": 0,
          "size": 0,
          "step": 0
        },
        "groups": [
          {
            "id": "<string>",
            "name": "<string>"
          }
        ],
        "name": "<string>",
        "payload": {
          "mode": "<string>",
          "pattern": "<string>",
          "seed": 0
        },
        "stack": [
          {
            "fields": {
              "<key>": {}
            },
            "protocol": "<string>"
          }
        ],
        "version": 0
      }
    }

Responses

4 responses

Status
Description
Type
200
OKobject
400
Invalid request body or template; template errors are listed in data.issues[]{path, message}object
401
Unauthorizedobject
413
Request body exceeds 8 MiBobject
  • {
      "frames": [
        {
          "hex": "<string>",
          "index": 0,
          "layers": [
            {
              "fields": [
                {}
              ],
              "length": 0,
              "name": "<string>",
              "offset": 0,
              "protocol": "<string>"
            }
          ],
          "payload": {
            "length": 0,
            "offset": 0
          },
          "size": 0
        }
      ],
      "info": {
        "fieldCycle": 0,
        "headersLength": 0,
        "layers": [
          {
            "length": 0,
            "offset": 0,
            "protocol": "<string>"
          }
        ],
        "maxFrameSize": 0,
        "minFrameSize": 0,
        "randomFields": true,
        "runtimeFields": [
          {
            "kind": "<string>",
            "offset": 0,
            "path": "<string>"
          }
        ],
        "sizeCycle": 0,
        "unboundFields": [
          "<string>"
        ]
      },
      "port": 0,
      "ports": [
        {
          "agentId": 0,
          "interface": "<string>",
          "network": "<string>"
        }
      ]
    }
  • {
      "data": {},
      "error": "<string>"
    }
  • {
      "data": {},
      "error": "<string>"
    }
  • {
      "data": {},
      "error": "<string>"
    }