Axtrinet APG4 User manual

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 1 7 June 2017
Ethernet Packet Generator
TCL API GUIDE
Version 1.0
APG4 APG8 APG200 APG208

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 2 7 June 2017
Software Revisions
This document applies to the following software versions:
APG TCL API
Embedded Software
FPGA
Version 1.0.0
Version 2.0
Version 6.010B
Revision History
Date
Version
Changes
12 August 2016
0.8
Restricted customer release
7 June 2017
1.0
General Release
Added APG200
Added Timestamp Analysis (see Section 3.7)
Added API Initialisation (Section 4)
apgGetVersion renamed to apgGetApiVersion (Section 4.2)
apgOpen waits for unit ready (Section 5.1.1)
Removed inconsistencies in apgSaveConfiguration PORTLIST
(see Section 6.1.1)
RXTIME replaces TIMESTAMP in apgGetPort CAPTURE PACKET
command (see Section 8.2.8)
apgSetPort command simplified (Section 8.3.1)
Added apgSetPort TOPOLOGY command to enable switching
between 40G / 4x10G modes (Section 8.3.1)
Added Deep Packet Capture (see Section 8.1.3)
Added Packet/Second Transmit Rate (Section 9.3.2)
Added Multi-Burst Transmit Mode (Section 9.3.2)
apgLoadStream command modified (Section 9.1.1)
Visit www.axtrinet.com/documentation for the latest documentation.
Document Conventions
INFORMATION:
Additional information to clarify functionality or usability
WARNING:
Clarification of unexpected or restricted functionality

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 3 7 June 2017
Disclaimer
Axtrinet retains the right to make changes to this document at any time, without notice. The
information in this document is believed to be accurate and reliable. Axtrinet does not warrant
the accuracy of completeness of the information, text, graphics or other items contained within
this document.
Axtrinet provides the software and the documentation "as is" without warranties of any kind.
Axtrinet disclaims all warranties and representations of any kind relating to products, software
or services provided hereunder, whether express, implied, statutory, including without
limitation the implied warranties of merchantability, fitness for a particular purpose, accuracy,
or non-infringement of third party rights.
Axtrinet does not warrant that the software will in every case process all data correctly, or that
operation of the products, including software, will be uninterrupted, free from error, or secure.
The disclaimers in this section will not apply to the extent prohibited by applicable law.
The software is not designed, intended, or certified for use in components of systems intended
for the operation of weapons, weapons systems, nuclear installations, means of mass
transportation, aviation, medical systems, devices, implants, or equipment, pollution control,
hazardous substances management, or for any other dangerous application in which the failure
of the products could create a situation where bodily injury or death may occur. The use of the
software in any such application is solely at your own risk.
Copyright statement
Copyright © 2017 Xentech Solutions Limited, all rights reserved. The information contained in
this document is the property of Xentech Solutions Limited. No part of this publication shall be
reproduced, stored or transmitted in any form or by any means without the prior written
permission of Xentech Solutions Limited.
Axtrinet™ is a trading name and registered trademark of Xentech Solutions Ltd.

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 4 7 June 2017
Preface
About This Document
This manual describes the structure and commands of the Axtrinet TCL API, and contains the
following sections:
Section
Description
1. INTRODUCTION
Summary of the TCL API interface and capabilities
2. INSTALLATION
Installation procedures for the Microsoft™ Windows™ and
Linux drivers and TCL API Interface
3. TEST ENVIRONMENT
Introduction to Ethernet packet generation, packet
structures and control
4. API INITIALISATION
Initialising the APG TCL API and version command
5. CONNECTION COMMANDS
Open and Close connections to the APG units
6. CONFIGURATION COMMANDS
Save and Apply unit configurations
7. UNIT COMMANDS
Unit-level connection, load, and get TCL commands
8. PORT COMMANDS
Port-level configuration load, get, set and apply TCL
commands
9. STREAM COMMANDS
Stream-level configuration load, get, set and apply TCL
commands
10. TOOLS
Command and Header tools to simplify access to the
internal database variables
Related Documentation
[1] APG-GSG Axtrinet Getting Started Guide
[2] APG-UG Axtrinet User Guide (including APG Control Interface)
[3] APG-HDR Axtrinet Header Definitions
[4] APG-SW-TC Axtrinet APG Software License Terms And Conditions
Visit www.axtrinet.com/downloads for the latest documentation.

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 5 7 June 2017
Glossary
APG Axtrinet Packet Generator
API Application Programming Interface
FCS Frame Checksum
IBG Inter-Burst Gap
IFG Inter-Frame Gap
pps Packets per Second
QSFP+ Quad Small Form-Factor Pluggable (40Gbps)
RPM Revolutions per Minute
SFD Start-of-Frame Delimiter
SFP Small Form-Factor Pluggable (1Gbps)
SFP+ Small Form-Factor Pluggable (10Gbps)
TCL Tool Command Language
USB Universal Serial Bus

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 6 7 June 2017
Contents
1. INTRODUCTION .............................................................................................. 9
1.1 Main Features ................................................................................................. 9
1.2 Benefits .......................................................................................................... 9
1.3 Trademarks .................................................................................................... 9
1.4 Software Licences and Support..................................................................... 10
1.5 Contact Details ............................................................................................. 10
2. INSTALLATION ............................................................................................. 11
2.1 Minimum System Requirements ................................................................... 11
2.2 Prerequisites ................................................................................................ 11
2.3 Testing the Installation ................................................................................ 11
2.3.1 Windows Environment.......................................................................................11
2.3.2 Linux Environment............................................................................................11
2.4 Example Files................................................................................................ 12
3. TEST ENVIRONMENT & CONCEPTS ................................................................ 13
3.1 Definitions .................................................................................................... 14
3.2 APG Configuration ........................................................................................ 15
3.3 Port Topology ............................................................................................... 15
3.3.1 SFP+ Ports ......................................................................................................15
3.3.2 QSFP+ Ports ....................................................................................................15
3.4 Transmit Configuration................................................................................. 16
3.5 Receive Path ................................................................................................. 18
3.6 Packet Capture ............................................................................................. 19
3.7 Packet Analysis............................................................................................. 19
4. API INITIALISATION.................................................................................... 20
4.1 Initialisation ................................................................................................. 20
4.1.1 Windows Environment.......................................................................................20
4.1.2 Linux Environment............................................................................................20
4.2 Version Command - apgGetApiVersion ......................................................... 20
4.2.1 apgGetApiVersion [VAR] ....................................................................................20
5. CONNECTION COMMANDS ............................................................................ 21
5.1 Open Connection - apgOpen ......................................................................... 21
5.1.1 apgOpen [IP-ADDRESS] ....................................................................................21
5.2 Close Connection - apgClose ......................................................................... 21
5.2.1 apgClose [UNITID]............................................................................................21
6. CONFIGURATION COMMANDS....................................................................... 22
6.1 Save Configuration ....................................................................................... 22
6.1.1 apgSaveConfiguration [UNITID] [PORTLIST] {FILENAME} .....................................22
6.2 Apply Configuration ...................................................................................... 23
6.2.1 apgApplyConfiguration [UNITID] [FILENAME] .......................................................23
7. UNIT COMMANDS.......................................................................................... 24
7.1 Load Unit Data - apgLoadUnit ....................................................................... 25
7.1.1 apgLoadUnit [UNITID] INFO...............................................................................25
7.1.2 apgLoadUnit [UNITID] STATUS...........................................................................25
7.1.3 apgLoadUnit [UNITID] PORTSTATUS ...................................................................25
7.1.4 apgLoadUnit [UNITID] COUNTERS ......................................................................26

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 7 7 June 2017
7.1.5 apgLoadUnit [UNITID] RATES {DURATION} .........................................................26
7.2 Get Unit Data - apgGetUnit ........................................................................... 27
7.2.1 apgGetUnit [UNITID] INFO [VAR] .......................................................................27
7.2.2 apgGetUnit [UNITID] STATUS [VAR] ...................................................................28
8. PORT COMMANDS ......................................................................................... 29
8.1 Load Port Data - apgLoadPort....................................................................... 31
8.1.1 apgLoadPort [PORTID] INFO ..............................................................................31
8.1.2 apgLoadPort [PORTID] MODULE .........................................................................31
8.1.3 apgLoadPort [PORTID] CAPTURE [VAR] {NUMPKT} ...............................................31
8.1.4 apgLoadPort [PORTID] ANALYSIS {TSID}............................................................32
8.2 Get Port Data - apgGetPort ........................................................................... 32
8.2.1 apgGetPort [PORTID] INFO [VAR].......................................................................32
8.2.2 apgGetPort [PORTID] STATUS [VAR]...................................................................34
8.2.3 apgGetPort [PORTID] MODULE [VAR]..................................................................35
8.2.4 apgGetPort [PORTID] TXSTATS [VAR] .................................................................36
8.2.5 apgGetPort [PORTID] RXSTATS [VAR] .................................................................37
8.2.6 apgGetPort [PORTID] RATES [VAR].....................................................................38
8.2.7 apgGetPort [PORTID] CAPTURE CONFIG [VAR].....................................................39
8.2.8 apgGetPort [PORTID] CAPTURE PACKET TOTALPACKETS .......................................40
8.2.9 apgGetPort [PORTID] CAPTURE PACKET [VAR] [PKTNUM]......................................40
8.2.10 apgGetPort [PORTID] ANALYSIS [TYPE] [VAR] .....................................................41
8.3 Set Port Configuration - apgSetPort ............................................................. 42
8.3.1 apgSetPort [PORTID] [VAR] [VAL] ......................................................................42
8.4 Apply Port Configuration - apgApplyPort ...................................................... 43
8.4.1 apgApplyPort [PORTID] STATE ...........................................................................43
8.5 Control Commands - apgControlPort ............................................................ 44
8.5.1 apgControlPort [COMMAND] [PORTLIST] .............................................................45
8.5.2 apgControlPort [CAPTURE] [PORTLIST] ...............................................................45
8.5.3 apgControlPort CLEARANALYSIS [PORTLIST]........................................................46
9. STREAM COMMANDS ..................................................................................... 47
9.1 Load Stream Configuration - apgLoadStream ............................................... 48
9.1.1 apgLoadStream [STREAMID]..............................................................................48
9.2 Get Stream Configuration - apgGetStream.................................................... 48
9.2.1 apgGetStream [STREAMID] CONFIG [VAR] ..........................................................49
9.2.2 apgGetStream [STREAMID] HEADER HEADER_LIST ..............................................50
9.2.3 apgGetStream [STREAMID] HEADER [HDR] [FLD] ................................................50
9.2.4 apgGetStream [STREAMID] PAYLOAD [VAR] ........................................................51
9.3 Set Stream Configuration - apgSetStream .................................................... 52
9.3.1 apgSetStream [STREAMID] DEFAULT ..................................................................53
9.3.2 apgSetStream [STREAMID] CONFIG [VAR] [VAL] .................................................53
9.3.3 apgSetStream [STREAMID] HEADER HEADER_LIST [HDRLIST] ..............................54
9.3.4 apgSetStream [STREAMID] HEADER [HDR] [FLD] [VAL] ........................................54
9.3.5 apgSetStream [STREAMID] HEADER [HDR] [FLD] [VAL] [MODE] [STEP][MIN][MAX].56
9.3.6 apgSetStream [STREAMID] PAYLOAD [VAR] [VAL]................................................56
9.4 Apply Stream Configuration - apgApplyStream............................................. 56
9.4.1 apgApplyStream [STREAMID].............................................................................57
10. TOOLS........................................................................................................... 58
10.1 Command Tools ............................................................................................ 58
10.1.1 apgGetVariables [COMMAND] {FUNCTION} .........................................................58
10.2 Header Tools................................................................................................. 58
10.2.1 apgGetHeaderList [STREAMID]...........................................................................58
10.2.2 apgGetHeaderFieldList [HDR] .............................................................................59
10.2.3 apgGetHeaderFieldValue [HDR] [FLD] [VAR] ........................................................59

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 9 7 June 2017
1. INTRODUCTION
Thank you for purchasing an Axtrinet™ APG Ethernet Packet Generator.
The Axtrinet APG Ethernet Packet Generators provide compact and affordable 40Gbps and
10Gbps Ethernet Packet Generator/Analysers with a simple-to-use Control Interface and an
open TCL API for third party scripting.
Ideally suited to applications in R&D, Test and Manufacturing environments, and 'on the road'
with Field Sales and Application Engineers, the Axtrinet APG Ethernet Packet Generators allow
reliable and affordable development and testing of:
Ethernet network equipment such as switches, routers, firewalls and network monitoring
devices
Data storage equipment with 10Gbps and 40Gbps Ethernet interfaces
Specialist devices such as FPGA accelerator NIC cards and offload appliances
Ethernet infrastructure installations encompassing cabling and switches
1.1 MAIN FEATURES
Highly configurable Ethernet Packet Generation
Full wire-speed operation on all ports
Industry standard QSFP+ and SFP+ ports
Real-time packet counts and error detection
Packet Capture for post-test analysis
Simple to use Control Interface for configuration and control
Clear LED status indication for unit operation and Ethernet traffic generation/reception
USB 2.0 port for easy set up and local management and 10/100Mbps Ethernet LAN
connection for flexible remote management
1.2 BENEFITS
Low cost allows multiple units to be deployed in a development environment –one per
desk
Easy to set up and use. Avoids the need for complex vendor specific programming skills
Ideal for integration into a manufacturing test environment using TCL scripting interface
Flexible choices of interfaces allows use with different speeds and media types, maximising
the investment across multiple projects
Small size, 1U high (44mm) and 146mm wide, for desk-top or rack shelf mounting (1/3
rack width)
1.3 TRADEMARKS
Windows is a registered trademark or trademark of Microsoft Corporation, registered in the
U.S. and other countries.
ActiveTcl is a registered trademark or trademark of ActiveState, registered in the Canada and
other countries.
Axtrinet is a registered trademark of Xentech Solutions Limited, registered in the UK.

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 10 7 June 2017
1.4 SOFTWARE LICENCES AND SUPPORT
See the Axtrinet APG Software License Terms & Conditions [4]
Email based software support is included in the purchase price for the first 12 months after
delivery. Extended Software Support is available for purchase; please contact Axtrinet or your
reseller for more information.
1.5 CONTACT DETAILS
Technical assistance is available from Axtrinet at the following address:
Address:
Xentech Solutions
Suite 6 Stanta Business Centre
3 Soothouse Spring
St Albans
AL3 6PF
UK
Phone:
+44 (0)1727 867795
Email:
Technical Support:
Sales:
Web Site:
www.axtrinet.com

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 11 7 June 2017
2. INSTALLATION
APG TCL API installation process on a host PC running Linux or Windows is described in the
APG User Guide [2] Section 2.
2.1 MINIMUM SYSTEM REQUIREMENTS
Processor
Pentium-class processor or equivalent
Memory
2GB (4GB recommended)
Disk Space
15MB
OS
64bit (x86_64) Linux systems
Microsoft Windows 7
Microsoft Windows 8.x
Microsoft Windows 10.x
Interfaces
Minimum: USB 2.0
Preferred: USB 2.0 & 10/100Base-T
2.2 PREREQUISITES
In the Windows Environment, a TCL distribution (such as Activestate®ActiveTcl) must be
installed before using the APG TCL API.
In the Linux Environment, the TCL package for your 8.6.x distribution must be installed before
using the APG TCL API.
2.3 TESTING THE INSTALLATION
2.3.1 Windows Environment
The Axtrinet TCL package is installed in C:/Program Files/Axtrinet/APG/tcllib
To test the installation, run "test.tcl" in the /examples directory:
% cd C:/Program Files/Axtrinet/APG/examples/
% tclsh test.tcl
APG TCL API V1.0.0
Build Date 1496403379
Target API Version 161016
The Axtrinet TCL API has been successfully installed if test.tcl completes without errors, and
displays the API version, build data and target API version.
2.3.2 Linux Environment
The Axtrinet TCL package is installed in /usr/share/axtrinet/apg/
To test the installation, run "test.tcl" in the /examples directory:
$ ./usr/share/axtrinet/apg/examples/test.tcl
APG TCL API V1.0.0
Build Date 1496403379
Target API Version 161016
The Axtrinet TCL API has been successfully installed if test.tcl completes without errors, and
displays the API version, build data and target API version.

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 12 7 June 2017
2.4 EXAMPLE FILES
Example files are provided in the demo directory that can be run within your TCL environment:
1.
demo_init.tcl
Initialise Axtrinet APG API Package
2.
demo_connection.tcl
Open and Close connections to the Axtrinet APG
3.
demo_save_recall.tcl
Save and load port and stream configuration
4.
demo_unit_commands.tcl
Load and display unit information
5.
demo_port_commands.tcl
Load and display unit and port information.
It includes the following examples:
a) demo_generate_portlist.tcl
Generate list of unit ports and streams
b) demo_configure_stream.tcl
Configure streams and apply to unit
c) demo_port_control.tcl
Start/stop traffic, calculate rates, capture packets
d) demo_port_counters.tcl
Read and display port counters and rates
e) demo_port_capture.tcl
Read and display captured packets

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 13 7 June 2017
3. TEST ENVIRONMENT &CONCEPTS
The Test Environment consists of one or more Axtrinet Packet Generators. The APG TCL API
can connect to single or multiple units over the Ethernet management interface. The units
may be located in the same location, or in geographically separate locations connected by a
WAN.
LAN
LAN
WAN
All accessible units can be managed through the same Control Interface or TCL scripting
interface. The APG TCL API and the APG Control Interface share the same API to the Axtrinet
Packet Generator:
APG TCL API
API Interface
APG Control
Interface
Management Interface
Ethernet
API Interface
APG Management
Packet Generator FPGA
10Gbps
10Gbps
10Gbps
10Gbps
10Gbps
10Gbps
10Gbps
10Gbps
40Gbps
40Gbps
User TCL
The APG TCL API only runs over the Ethernet Management Interface.
The Axtrinet APG API provides a TCL scripting interface for automated test generation.
The API provides access to:
unit, port and stream configuration and status
packet counters (packets, bytes, errors)
receive filters and packet capture tools
port control (start, step, stop)
The Axtrinet APG Control Interface is described in the APG User Guide [2].

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 14 7 June 2017
3.1 DEFINITIONS
UNIT
A unit is a single physical Axtrinet Packet Generator (APG4, APG8, APG200 or
APG208).
A unit is assigned a UNITID when the management connection is first opened
using the APG TCL API. The UNITID is fixed for the duration of the TCL session,
and is used to uniquely identify a unit during the session. The UNITIDs will be
reassigned if the TCL session is restarted.
Unit commands enable management connections; provide access to the unit
status (See Section 4).
PORT
A PORT is a physical aperture on the unit (SFP+ or QSFP+).
Ports are numbered from 1.
The UNITID is used in conjunction with the PORT number to create the PORTID
(eg Unit 2, Port 7 has a PORT ID {2 7}). The PORTID is fixed for the duration
of the TCL session, and is used to uniquely identify a port during the session.
Port commands allow access to the modules; port capabilities and
configuration; and port counters (see Section 8).
SUBPORT
Where a QSFP+ port can be configured into different topologies (eg 40Gbps or
4x10Gbps), the PORTID is qualified with a SUBPORT.
Subports are numbered from 1.
The UNITID is used in conjunction with the PORT and SUBPORT number to
create the SUBPORTID (eg Unit 3, Port 10, Subport 1 has a SUBPORT ID
{3 10 1}). The SUBPORTID is fixed for the duration of the TCL session, and is
used to uniquely identify a port during the session.
Subports use the Port commands to gain access to the modules; port
capabilities and configuration; and port counters (see Section 8).
MODULE
A MODULE is a SFP+ or QSFP+ transceiver, and must be inserted into a port
aperture to enable a link. Module configuration and status are accessed with
the Port Commands (see Section 8)
STREAM
A transmit stream generates a controlled number of Ethernet frames with a
defined length and rate; fixed header configuration with a fixed or varying
header contents; and a fixed or varying payload.
The UNITID and PORTID are used in conjunction with the STREAM number to
create the STREAMID (eg Unit 1, Port 3 Stream 2 has a STREAMID {1 3 2}).
When a port has subports, the SUBPORTID is also required to form the
STREAMID (eg Unit 1, Port 9, Subport 2 Stream 6 has a STREAMID {1 9 2 6}).
The STREAMID is fixed for the duration of the TCL session, and is used to
uniquely identify a stream during the session.
The outputs from the eight stream generators are multiplexed into a single
stream for transmission from a port.
Stream commands allow the stream configuration to be read from the unit,
modified and written to the unit (See Section 9)

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 15 7 June 2017
3.2 APG CONFIGURATION
The 'master' unit, port and stream configurations are stored on the Axtrinet™ APG unit.
The TCL API uses a 'local' database to store the current and modified configurations, before
being applied into the unit.
apgLoad LOCAL
DATABASE
apgGet
apgApply apgSet
The TCL API provides the tools to apgLoad the APG unit configuration and status into the local
database, read (apgGet) and modify (apgSet) the local database, and write (apgApply) to
the APG unit.
The traffic generator is controlled with the apgControl command.
The unit retains its configuration over a power cycle.
3.3 PORT TOPOLOGY
Port Topology defines the physical port configuration (eg 40Gbps, 4x10Gbps), rather than the
interface type (eg QSFP+).
Port topologies is changed with the apgSetPort TOPOLOGY command (see Section 8.3.1).
3.3.1 SFP+ Ports
The SFP+ Port Topology is fixed 10Gbps only.
3.3.2 QSFP+ Ports
The QSFP+ interface topology can be configured in 40Gbps mode (default) or 4X10Gbps mode,
where each of the 10Gbps lanes that comprise the 40Gbps link are managed independently.
Changing the port topology of a QSFP+ port changes both the transmit and receive paths.
Stream
Generators
40Gbps
MAC
10Gbps
Serdes
10Gbps
Serdes
10Gbps
Serdes
10Gbps
Serdes
QSFP+
Module MPO
a) QSFP+ Port in 40Gbps Topology (default)
S t r e a m
G e n e r a t o r s
S t r e a m
G e n e r a t o r s
S t r e a m
G e n e r a t o r s
S t r e a m
G e n e r a t o r s
1 0 G b p s
M A C
1 0 G b p s
S e r d e s
1 0 G b p s
M A C
1 0 G b p s
S e r d e s
1 0 G b p s
M A C
1 0 G b p s
S e r d e s
1 0 G b p s
M A C
1 0 G b p s
S e r d e s
Q S F P +
M o d u l e M P O
b ) Q S F P + P o r t i n 4 x 1 0 G b p s T o p o l o g y
Switching between 40Gbps and 4x10Gbps topologies is performed with the apgSetPort
TOPOLOGY command (see Section 8.3.1).
Mixed topology of the QSFP+ ports is only available with Port 9 at 4x10Gbps, and
Port 10 at 40Gbps. Setting Port 9 to 40Gbps or Port 10 to 4x10Gbps topologies will
automatically switch the other port into the same mode.

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 16 7 June 2017
3.4 TRANSMIT CONFIGURATION
Each port contains a transmit engine that comprises:
8 parallel independent configurable Ethernet stream generators
Stream multiplexer
Transmit port configuration and status
Module configuration and status
STREAM 0
STREAM 1
STREAM 2
STREAM 3
STREAM 4
STREAM 5
STREAM 6
STREAM 7
+PORT N MODULE
Status Status
Enable
Rate
Length
Header
Payload
Enable Enable
ContentsCounters
The streams are processed in a round-robin sequence, transmitting a packet if it queued and
ready to send.
To bring a link up, both the port and module must be enabled.
To transmit a stream, the port, module and stream must be enabled.
The transmit mode must be CONTINUOUS or a non-zero BURST.
The Stream Generator defines an Ethernet frame:
HEADERS PAYLOAD TIMESTAMP
(OPTIONAL)
FRAME LENGTH
4 BYTES
FIXED, INCREMENTING, DECREMENTING, RANDOM
HEADER AND FIELD LENGTHS NOT DRAWN TO SCALE
SFD
Start-of-
Frame
Delimiter FRAME
IPG
Inter
Packet
Gap
12 BYTES(min) 8 BYTES
PACKET
FRAME
NEXT PACKET
FRAME
PREVIOUS PACKET
SFDIPG
FCS
Frame
Checksum
16 BYTES
A transmit stream generates a controlled number of Ethernet frames at a controlled length and
rate; with a fixed header configuration, fixed or varying header contents, and a fixed or
varying payload.
Streams can be enabled or disabled using apgGetStream CONFIG.

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 17 7 June 2017
The stream transmit mode can be set using apgSetStream CONFIG, and defines how the
packets are generated: either Continuously; as a Single Burst of TX_BURST_SIZE packets; or
a Multiple Burst of TX_BURST_SIZE packets, repeated TX_BURST_COUNT times, separated
by TX_IBG.
T=0
CONTINUOUS
SINGLE BURST
MULTIPLE BURSTS
TX_IBG TX_BURST SIZE
TX_BURST COUNT = 1
TX_BURST COUNT = 10
The stream transmit rate can be set using apgSetStream CONFIG.The stream rate can be
set as in percent, packets per second or clock cycles.
Care should be taken to ensure that the cumulative stream transmit rates does not
exceed the port capacity.
If the cumulative stream transmit rates does exceed the port capacity, the port will
transmit at wire rate, but the streams will transmit at a lower rate than configured.
The length defines the total length of the frame in bytes, including the headers, payload,
timestamp (if enabled) and 4-byte Frame Checksum (FCS). The length can be fixed, or
incrementing, decrementing or random over a range using apgSetStream CONFIG.
The HEADER is created by adding header types (eg MAC, VLAN, IPV4) to the stream using
apgSetStream HEADER HEADER_LIST.
Headers can be configured using apgSetStream HEADER.
HEADERS PAYLOAD FCS
TIMESTAMP
(OPTIONAL)
4 BYTES
DA SA VLAN IPV4 TCP
EG:
TYPE
FIXED, INCREMENTING, DECREMENTING, RANDOM
PID
EG:
PRI CFI VID
FIXED FIXED
INCREMENTING
DECREMENTING
RANDOM
FIXED FIXED
HEADER AND FIELD LENGTHS NOT DRAWN TO SCALE
SEQ
INCREMENTING
4 BYTES
TIMESTAMP
TIME
8 BYTES
ID
FIXED
4 BYTES
The payload can be fixed, or incrementing, decrementing or random over a range using
apgSetStream PAYLOAD. The payload may additionally include a timestamp and sequence
number.

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 18 7 June 2017
The optional "Timestamp Fields" incorporating the timestamp ID, Sequence Number and
Timestamp are enabled on a "per stream" basis using the apgSetStream PAYLOAD
TS_ENABLE command, and processed using the apgLoadPort ANALYSIS and apgGetPort
ANALYSIS commands.
To bring a link up, both the port and module must be enabled.
To transmit a stream, the port, module and stream must be enabled.
The transmit mode must be CONTINUOUS or a non-zero BURST.
Port link status and link speed are accessible using apgGetPort INFO and apgGetPort
STATUS, and the transmit counters can be read using apgGetPort TXSTATS.
A module can be enabled or disabled using apgSetPort command.
The module type, vendor and capabilities are accessible using apgGetPort MODULE.
The traffic generator is controlled with the apgControl command.
3.5 RECEIVE PATH
FILTER 0 is reserved for
internal use only
FILTER 0
FILTER 1
FILTER 2
FILTER 3
+
Mask
PORT NMODULE
Receive
Counters
CAPTURE
BUFFER
Filter
Counters
Captured
Data
Match
Enable
Control
Each port contains a receive path that comprises:
Module status
Receive port status and counters
Filter stream multiplexer
Configurable Capture Buffer
The port receive counters can be read using apgGetPort RXSTATS.
Configurable Capture Filters are not supported in APG TCL API V1.0
Software. All received port traffic is forwarded to the capture buffer.

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 19 7 June 2017
3.6 PACKET CAPTURE
A 16KB capture buffer is available per port, that can be enabled using the apgControlPort
PORTCAPTURE command. The contents of the capture buffer can be downloaded from the
unit with apgLoadPort CAPTURE, and read with apgGetPort CAPTURE PACKET.
A single port can be enabled to capture to the 'deep' 1GB capture buffer, with the
apgControlPort DEEPCAPTURE command.
Packet capture is disabled with the apgControlPort DISABLECAPTURE command, and
cleared with the apgControlPort CLEARCAPTURE command.
3.7 PACKET ANALYSIS
The Packet Analysis function provides basic analysis of the packet timestamp fields from the
captured packets, and analysed with the apgLoadPort ANALYSIS command.
The 'Timestamp' fields are added to each transmitted packet of a timestamp-enabled stream.
The transmit timestamp is the time of the first transmitted bit. The transmit sequence number
increments for each packet transmitted from a port.
The Timing Analysis provides packet transmit-to-receive timing (latency):
TSRX
TS=TSTX TS=TSRX
N BYTES
Transmit Receive
Latency = (TSRX - TSTX) x 8ns
N BYTES
HEADERS PAYLOAD ID SEQ TSTX FCS HEADERS PAYLOAD ID SEQ TSTX FCS
Transmit-to-transmit timing (transmit stability) and receive-to-receive timing (receiver
stability) are also performed:
Receive
TSRX1 HEADERS PAYLOAD ID SEQ1TSTX1 FCS
HEADERS PAYLOAD ID SEQ2TSTX2 FCSTSRX2
ΔRX = (TSRX2 –TSRX1) x 8ns ΔTX = (TSTX2 –TSTX1) x 8ns
The SEQUENCE numbers are checked for out-of-order packets, gaps and repeated values.
The analysis measurements are cleared using the apgControlPort CLEARANALYSIS
command. Each time captured data is analysed with apgLoadPort ANALYSIS, the results
are appended to the existing results.
The analysis results are read using apgGetPort ANALYSIS.

Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 20 7 June 2017
4. API INITIALISATION
The Axtrinet APG TCL API is initialised by sourcing the axtrinetApi.tcl file that contains:
Path to the APG TCL API
"package require" declaration
Import APG TCL API Commands
Header Definition file processing
4.1 INITIALISATION
4.1.1 Windows Environment
The APG TCL API is 'sourced' in the Windows environment with the following command:
# Instantiate APG TCL API
source "C:/Program Files/Axtrinet/APG/axtrinetApi.tcl"
←Load API
# Display TCL Version Info
puts "[apgGetApiVersion DESCRIPTION] [apgGetApiVersion VERSION]"
puts "Build Date [apgGetApiVersion BUILD_DATE]"
puts "Target API Version [apgGetApiVersion API_VERSION]"
→APG TCL API V1.0.0
→Build Date 1496403379
→Target API Version 161016
4.1.2 Linux Environment
The APG TCL API is 'sourced' in the Linux environment with the following command:
# Instantiate APG TCL API
source "/usr/share/axtrinet/apg/axtrinetApi.tcl"
←Load API
# Display TCL Version Info
puts "[apgGetApiVersion DESCRIPTION] [apgGetApiVersion VERSION]"
puts "Build Date [apgGetApiVersion BUILD_DATE]"
puts "Target API Version [apgGetApiVersion API_VERSION]"
→APG TCL API V1.0.0
→Build Date 1496403379
→Target API Version 161016
4.2 VERSION COMMAND -APGGETAPIVERSION
Get (read) the APG TCL API versions.
A LOAD command is not required before the apgGetApiVersion
4.2.1 apgGetApiVersion [VAR]
apgGetApiVersion returns the variable value if successful, otherwise the command will
display an error message and exit the TCL environment.
[VAR]
LENGTH
DESCRIPTION
Example
COMPANY
21 char
Xentech Solutions Ltd
BRAND
8 char
Axtrinet
DESCRIPTION
11 char
APG TCL API
VERSION
10 char
Axtrinet TCL API Version currently running
V1.0.0
BUILD_DATE
32 bits
Build date of the TCL API
1496403379
API_VERSION
6 char
Target API Version
161016
Other manuals for APG4
2
This manual suits for next models
3
Table of contents