INFORMATION:
Additional information to clarify functionality or usability
WARNING:
Clarification of unexpected or restricted functionality
This document applies to the following software versions:
Revision History
Ethernet Packet Generator
TCL API GUIDE
Visit www.axtrinet.com/documentation for the latest documentation.
Document Conventions
APG-TCL-UG-V1-0 2 7 June 2017
Page 3
Ethernet Packet Generator
TCL API GUIDE
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.
Axtrinet™ is a trading name and registered trademark of Xentech Solutions Ltd.
APG-TCL-UG-V1-0 3 7 June 2017
Page 4
Ethernet Packet Generator
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
TCL API GUIDE
Preface
About This Document
This manual describes the structure and commands of the Axtrinet TCL API, and contains the
following sections:
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.
APPENDIX A - QUICK REFERENCE GUIDE ............................................................... 60
APPENDIX B - SAMPLE APGSAVECONFIGURATION FILE ......................................... 64
APG-TCL-UG-V1-0 8 7 June 2017
Page 9
Ethernet Packet Generator
TCL API GUIDE
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.
ActiveTclis 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.
APG-TCL-UG-V1-0 9 7 June 2017
Page 10
Ethernet Packet Generator
Address:
Xentech Solutions
Suite 6 Stanta Business Centre
3 Soothouse Spring
St Albans
AL3 6PF
UK
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:
APG-TCL-UG-V1-0 10 7 June 2017
Page 11
Ethernet Packet Generator
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
% cd C:/Program Files/Axtrinet/APG/examples/
% tclsh test.tcl
APG TCL API V1.0.0
Build Date 1496403379
Target API Version 161016
$ ./usr/share/axtrinet/apg/examples/test.tcl
APG TCL API V1.0.0
Build Date 1496403379
Target API Version 161016
TCL API GUIDE
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
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:
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:
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.
APG-TCL-UG-V1-0 11 7 June 2017
Page 12
Ethernet Packet Generator
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:
Example files are provided in the demo directory that can be run within your TCL environment:
APG-TCL-UG-V1-0 12 7 June 2017
Page 13
Ethernet Packet Generator
LAN
LAN
WAN
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.
TCL API GUIDE
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.
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:
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].
APG-TCL-UG-V1-0 13 7 June 2017
Page 14
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 14 7 June 2017
Page 15
Ethernet Packet Generator
apgLoad
LOCAL
DATABASE
apgGet
apgApply
apgSet
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
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.
TCL API GUIDE
3.2 APGCONFIGURATION
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.
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.
Switching between 40Gbps and 4x10Gbps topologies is performed with the apgSetPort
TOPOLOGY command (see Section 8.3.1).
APG-TCL-UG-V1-0 15 7 June 2017
Page 16
Ethernet Packet Generator
STREAM 0
STREAM 1
STREAM 2
STREAM 3
STREAM 4
STREAM 5
STREAM 6
STREAM 7
+
PORT NMODULE
Status
Status
Enable
Rate
Length
Header
Payload
EnableEnable
ContentsCounters
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.
HEADERSPAYLOAD
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
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
TCL API GUIDE
The streams are processed in a round-robin sequence, transmitting a packet if it queued and
ready to send.
The Stream Generator defines an Ethernet frame:
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.
APG-TCL-UG-V1-0 16 7 June 2017
Page 17
Ethernet Packet Generator
T=0
CONTINUOUS
SINGLE BURST
MULTIPLE BURSTS
TX_IBGTX_BURST SIZE
TX_BURST COUNT = 1
TX_BURST COUNT = 10
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.
HEADERSPAYLOADFCS
TIMESTAMP
(OPTIONAL)
4 BYTES
DASAVLANIPV4TCP
EG:
TYPE
FIXED, INCREMENTING, DECREMENTING, RANDOM
PID
EG:
PRICFIVID
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
TCL API GUIDE
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.
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.
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.
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.
APG-TCL-UG-V1-0 17 7 June 2017
Page 18
Ethernet Packet Generator
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.
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
Configurable Capture Filters are not supported in APG TCL API V1.0
Software. All received port traffic is forwarded to the capture buffer.
TCL API GUIDE
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.
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
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.
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):
Transmit-to-transmit timing (transmit stability) and receive-to-receive timing (receiver
stability) are also performed:
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.
# 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
# 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
A LOAD command is not required before the apgGetApiVersion
[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
TCL API GUIDE
4. APIINITIALISATION
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:
4.1.2 Linux Environment
The APG TCL API is 'sourced' in the Linux environment with the following command:
4.2 VERSION COMMAND - APGGETAPIVERSION
Get (read) the APG TCL API versions.
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.
APG-TCL-UG-V1-0 20 7 June 2017
Page 21
5. CONNECTION COMMANDS
apgOpen / apgClose
Connection
apgOpen [IP-ADDRESS]
apgClose [UNITID]
Eg:
# Instantiate APG TCL API (Windows)
source "C:/Program Files/Axtrinet/APG/axtrinetApi.tcl"
← Load API
# Open connection to unit at IP address 192.168.1.100
# Returns integer Unit ID
set IPADDRESS 192.168.1.100
set UNITID [apgOpen $IPADDRESS]
puts "Opened connection to Unit $UNITID at $IPADDRESS"
→ UNITID = 1
# Close connection
apgClose $UNITID
→ 1
Ethernet Packet Generator
TCL API GUIDE
5.1 OPEN CONNECTION - APGOPEN
5.1.1 apgOpen [IP-ADDRESS]
Opens a connection to the Axtrinet Packet Generator at [IP-ADDRESS].
If the connection is successfully opened, apgOpen polls apgLoadUnit STATUS to determine
the hardware status until the unit is READY (apgLoadUnit STATUS READY = 1).
apgOpenthen loads the critical unit, port and stream information into the local databases
using the following commands:
apgLoadUnit [UNITID] INFO
apgLoadPort [PORTID] INFO
apgLoadStream [STREAMID]
If the connection is successfully opened and the critical configuration loaded from the unit,
apgOpen returns the UNITID of the new unit.
If the connection fails to open, apgOpen exits the TCL environment. The connection may fail
if two APG Control Interface or TCL management connections to the unit, the unit is being
upgraded or the unit fails to boot (check front panel LEDs).
5.2 CLOSE CONNECTION - APGCLOSE
5.2.1 apgClose [UNITID]
Closes the connection to the Axtrinet Packet Generator UNITID.
apgClosereturns 1 if successful, otherwise the command will display an error message and
# Instantiate APG TCL API (Windows)
source "C:/Program Files/Axtrinet/APG/axtrinetApi.tcl"
← Load API
# Open connection to unit at IP address 192.168.1.100
# Returns integer Unit ID
set IPADDRESS 192.168.1.100
set UNITID [apgOpen $IPADDRESS]
puts "Opened connection to Unit $UNITID at $IPADDRESS"
Open Connection
→ UNITID = 1
puts "Saving configuration"
set FILENAME APGexample.apg
apgSaveConfiguration $UNITID ALL $FILENAME
Save Configuration
puts "Closing Connection"
apgClose $UNITID
Close Connection
################################
set UNITID [apgOpen $IPADDRESS]
puts "Opened connection to Unit $UNITID at $IPADDRESS"
Open Connection
→ UNITID = 2
puts "Loading saved configuration $FILENAME"
apgApplyConfiguration $UNITID $FILENAME
Load Configuration
puts "Closing Connection"
apgClose $UNITID
Close Connection
TCL API GUIDE
6. CONFIGURATION COMMANDS
The configuration commands apgSaveConfiguration and apgApplyConfiguration allow the
unit configuration to be saved to and loaded from an external file.
An example saved configuration file is shown in APPENDIX B - Sample apgSaveConfiguration
File for port 1 only.
Saves the unit UNITID PORTLIST port configuration to FILENAME.
PORTLIST can be "ALL" or in the list of PORTID format, eg {{ 1 1 } { 1 3 }}
If FILENAME is not specified, the default filename [SERIAL].config is used where SERIAL is
apgGetUnit [UNITID] INFO SERIAL.
The saved configuration file contains the expected API_VERSION (apgGetUnit [UNITID]
INFO API_VERSION) and PRODUCT (apgGetUnit [UNITID] INFO PRODUCT)
A 'cut down' example file is shown in Appendix B for a single port and stream. A saved file for
the APG208 will contain the configuration for 10 ports each with 8 streams.
The saved configuration can be manually edited to modify the unit configuration.
APG-TCL-UG-V1-0 22 7 June 2017
Page 23
Ethernet Packet Generator
TCL API GUIDE
6.2 APPLY CONFIGURATION
6.2.1 apgApplyConfiguration [UNITID] [FILENAME]
Applies the stored configuration file FILENAME to unit UNITID.
File FILENAME is first scanned for suitability, verifying that the API_VERSION and PRODUCT
type match. If there is an API_VERSION mismatch, the commands may not apply. If there is
a PRODUCT mismatch, ports and stream configurations may not apply to the unit UNITID.
APG-TCL-UG-V1-0 23 7 June 2017
Page 24
7. UNIT COMMANDS
apgLoadUnit
LOCAL ‘UNIT’
DATABASE
apgOpen / apgClose
apgGetUnit
apgLoadUnit
apgLoadUnit [UNITID] INFO
apgLoadUnit [UNITID] STATUS
apgGetUnit [UNITID] INFO [VAR]
apgGetUnit [UNITID] STATUS [VAR]
Eg:
# Instantiate APG TCL API (Windows)
source "C:/Program Files/Axtrinet/APG/axtrinetApi.tcl"
← Load API
# Open Connection
set IPADDRESS 192.168.1.100
set UNITID [apgOpen $IPADDRESS]
# Load unit information into local database
apgLoadUnit $UNITID INFO
→ 1
# Get the unit information from the local database
set TYPE [apgGetUnit $UNITID INFO PRODUCT]
set SN [apgGetUnit $UNITID INFO SERIAL]
→ APG208
→ APG000006
# Display unit information
puts "Unit $UNITID is an $TYPE with S/N $SN"
# Load unit status into local database
apgLoadUnit $UNITID STATUS
→ 1
# Display unit status
set UPTIME [apgGetUnit $UNITID STATUS UPTIME]
puts "$SN has been on for [expr $UPTIME / 1000] secs"
→ Eg 23000
set READY [apgGetUnit $UNITID STATUS READY]
while !$READY {
puts "Unit $UNITID is still booting"
after 5000
set READY [apgGetUnit $UNITID STATUS READY]
}
→ 1
~60sec after turned on
→ 1
# Close connection
apgClose $UNITID
→ 1
Ethernet Packet Generator
TCL API GUIDE
APG-TCL-UG-V1-0 24 7 June 2017
Page 25
Ethernet Packet Generator
apgLoadUnit
LOCAL ‘UNIT’
DATABASE
apgOpen / apgClose
apgGetUnit
TCL API GUIDE
7.1 LOAD UNIT DATA - APGLOADUNIT
Load the UNIT configuration and status from the hardware into the local database.
apgLoadUnitreturns 1 if successful, otherwise the command will display an error message
and exit the TCL environment.
7.1.1 apgLoadUnit [UNITID] INFO
Loads the unit information into the local database, containing:
Unit Product ID and Serial Number
Hardware and Software Versions
Port Count
The port information can be read using apgGetUnit INFO.
7.1.2 apgLoadUnit [UNITID] STATUS
Loads the unit status into the local database, containing:
Uptime (ms)
Temperature, Fan and Status Flags
The unit status can be read using apgGetUnit STATUS.
7.1.3 apgLoadUnit [UNITID] PORTSTATUS
Loads the unit port status into the local database, containing:
Link Mode, Status and Speed
Module Type
Port Label
The port status can be read using apgGetPort STATUS.
APG-TCL-UG-V1-0 25 7 June 2017
Page 26
Ethernet Packet Generator
TCL API GUIDE
7.1.4 apgLoadUnit [UNITID] COUNTERS
Loads the transmit and receive counters for all ports in the unit into the local database,
containing:
Time that the counter is read
Number of Bytes
Number of Good Packets
Number of Underrun Packets
Number of Packet Fragments
Number of Packets with Frame Checksum (FCS) Errors
Number of Frames with No Start-of-Frame Delimiter (SFD)
Frame Rate (pps)
Port transmit counters can be read using apgGetPort TXSTATS.
Port receive counters can be read using apgGetPort RXSTATS.
7.1.5 apgLoadUnit [UNITID] RATES {DURATION}
The transmit and receive rates are calculated when apgLoadUnit RATES is called.
The rate calculator takes two counter readings, separated by {DURATION} milliseconds
(eg 2000 = 2sec), to calculate the transmit and receive frame, byte, bit and error rates. If
{DURATION} is omitted, a duration of 1000ms is assumed.
The transmit and receive rates are stored in the local database, containing:
Transmit Frame, Byte and Bit Rates
Receive Frame, Byte, Bit and Error Rates
Port rates can be read using apgGetPort RATES.
APG-TCL-UG-V1-0 26 7 June 2017
Page 27
Ethernet Packet Generator
apgLoadUnit
LOCAL ‘UNIT’
DATABASE
apgOpen / apgClose
apgGetUnit
[VAR]
LENGTH
DESCRIPTION
API_VERSION
32 bits
API Version of the Firmware eg 160229
PORT_COUNT
8 bits
Number of physical ports on the unit
API_MINIMUM
32 bits
Minimum API supported by the unit
[apgGetApiVersion API_VERSION] must be greater
than API_MINUMUM, and should ideally match.
SERIAL
16 chars
Serial Number eg APG000006
PRODUCT
12 chars
Product Code eg APG208
FW_VERSION
8 chars
Firmware Version loaded onto the UNIT eg 1.2-1
FW_BUILDDATE
32 bits
Build timestamp of the Firmware Version loaded onto the
UNIT eg 1457534868
FPGA_VERSION
8 chars
Firmware Version loaded onto the UNIT eg 1.652
FPGA_BUILDDATE
32 bits
Build timestamp of the Firmware Version loaded onto the
UNIT eg 1455890890
HW_VERSION
8 chars
Hardware Version of the Unit eg A.00.00
TCL API GUIDE
7.2 GET UNIT DATA - APGGETUNIT
Get (read) the UNIT configuration and status from the local database.
apgGetUnitreturns the variable value if successful, otherwise the command will display an
error message and exit the TCL environment.
7.2.1 apgGetUnit [UNITID] INFO [VAR]
The APG unit information can be read with the apgGetUnit INFO command.
The apgGetUnit INFO command must be preceded by at least one apgLoadUnit INFO,
otherwise the command will display an error message and exit the TCL environment.
The unit INFO is static for the duration of the test session, and should only need to be read
once at the start of the test.
APG-TCL-UG-V1-0 27 7 June 2017
Page 28
Ethernet Packet Generator
[VAR]
LENGTH
DESCRIPTION
UPTIME
64 bits
Time since the unit was powered up (in ms)
TEMP
2 bits
Temperature Flags, calculated from the preset T
OPERATE
, T
WARNING
and T
SHUTDOWN
temperature thresholds:
0 = OK T ≤ T
OPERATE
+ 3
1 = HIGH T
OPERATE
+ 3 ≤ T < T
WARNING
2 = WARNING T
WARNING
≤ T < T
SHUTDOWN
3 = ALARM T > T
WARN
FAN
1 bit
0 = Fan Failed
1 = Fan OK
SELFTEST
1 bit
0 = Self-Test Failed
1 = Self-Test Passed
Self-Test verifies that the internal power supplies are
within tolerance and that the CPU interfaces are
operational.
READY
1 bit
0 = Unit not ready (FPGA Booting)
1 = Unit Ready (FPGA Booted)
TCL API GUIDE
7.2.2 apgGetUnit [UNITID] STATUS [VAR]
The APG unit status can be read with the apgGetUnit STATUS command.
The apgGetUnit STATUS command must be preceded by at least one apgLoadUnit
STATUS, otherwise the command will display an error message and exit the TCL environment.
The unit STATUS is dynamic, and should be re-loaded before reading.
after 1000
puts "DEMO: Calculating data rates over 1000ms"
apgLoadUnit $UNITID RATES 1000
puts "DEMO: Clearing Capture Buffers and enabling Capture on all ports "
apgControlPort PORTCAPTURE $PORTLIST
after 1000
puts "DEMO: Stopping Traffic"
apgControlPort STOPTX $PORTLIST
TX Control
Clear counts
Start TX
Calculate
Rates
Enable Capture
Stop TX
# Port Counters
puts "\nDEMO: Display Port Counters"
apgLoadUnit $UNITID COUNTERS
foreach PORTID $PORTLIST {
scan $PORTID "%d %d %d" UN PO SP
set TXPKT [apgGetPort $PORTID TXSTATS GOOD_PACKETS]
set TXRATE [expr [apgGetPort $PORTID RATES TXBITRATE] / 1000000.0]
set RXPKT [apgGetPort $PORTID RXSTATS GOOD_PACKETS]
if { $TXPKT > 0 } {
puts [format " Port %2d TX %7d at %8.2f Mbps, RX %7d packets" \
$PO $TXPKT $TXRATE $RXPKT]
}
}
Counters
Load
Get counters
# Port Capture
puts "\nDEMO: Display Captured Packets"
foreach PORTID $PORTLIST {
scan $PORTID "%d %d %d" UN PO SP
apgLoadPort $PORTID CAPTURE CONFIG
set AVAILABLE [apgGetPort $PORTID CAPTURE CONFIG AVAILABLE ]
if { $AVAILABLE > 0 } {
apgLoadPort $PORTID CAPTURE BUFFER
puts "\n Port $PO:\n"
set PKTCOUNT [ apgGetPort $PORTID CAPTURE PACKET TOTALPACKETS ]
for { set PKT 1 } { $PKT <= $PKTCOUNT } { incr PKT } {
set LENGTH [apgGetPort $PORTID CAPTURE PACKET LENGTH $PKT]
puts -nonewline [format " %3d: %5d bytes -> " $PKT $LENGTH]
set DATA [apgGetPort $PORTID CAPTURE PACKET DATA $PKT]
foreach BYTE $DATA { puts -nonewline [format "%02X " $BYTE] }
puts ""
}
}
}
Capture
Load config
If data ...
Load buffer
Display data
# Close connection
apgClose $UNITID
Close
connection
TCL API GUIDE
APG-TCL-UG-V1-0 30 7 June 2017
Page 31
Ethernet Packet Generator
apgLoadPort
apgApplyPort
LOCAL ‘PORT’
DATABASE
apgGetPort
apgSetPort
Only the ID, VENDOR and DIAGNOSTIC information is available.
[VAR]
DESCRIPTION
CONFIG
Load the port capture configuration into the local port database.
BUFFER
Load the port capture buffer into the local port database
{NUMPKT} is an optional field to define the number of packets to be
downloaded from the unit, starting from the first captured packet. If
{NUMPKT} is not declared, all captured packets are downloaded from
the unit.
apgLoadPort CAPTURE BUFFER takes ~1secs to download and process a full
10Gbps port capture, and ~3sec to download and process a full 40Gbps port
capture.
A full 66MB DEEP CAPTURE buffer will take ~12min to download
TCL API GUIDE
8.1 LOAD PORT DATA - APGLOADPORT
Loads the PORT configuration and status from the hardware into the local database.
apgLoadPortreturns 1 if successful, otherwise the command will display an error message
and exit the TCL environment.
8.1.1 apgLoadPort [PORTID] INFO
Loads the port information into the local database, containing:
Port Topology (eg 40Gbps or 4x10Gbps)
Impact of Topology Change flags
Number of Subports (eg 1 for 10Gbps Ports, 4 for 40Gbps Ports)
Maximum Number of Streams (8)
Maximum Number of Filters (4)
The port information can be read using apgGetPort INFO.
8.1.2 apgLoadPort [PORTID] MODULE
Loads the module information into the local port database.
The port information can be read using apgGetPort MODULE.
8.1.3 apgLoadPort [PORTID] CAPTURE [VAR] {NUMPKT}
Loads the contents of the port capture configuration or buffer into the local port database.
The port information can be read using apgGetPort CAPTURE.
APG-TCL-UG-V1-0 31 7 June 2017
Page 32
Ethernet Packet Generator
apgLoadPort
LOCAL ‘PORT’
DATABASE
apgGetPort
apgApplyPort
apgSetPort
[VAR]
LENGTH
DESCRIPTION
TOPOLOGY
16 bits
Current port topology:
Bit 0-7 = Reserved
Bit 8 = Blocked (0x0100)
Bit 9 = 1Gbps (0x0200)
Bit 10 = Reserved
Bit 11 = 10Gbps (0x0800)
Bit 12 = 4x10Gbps (0x1000)
Bit 13 = 40Gbps (0x2000)
Bit 14-15 = Reserved
TCL API GUIDE
8.1.4 apgLoadPort [PORTID] ANALYSIS {TSID}
The port analysis calculations are performed when apgLoadPort ANALYSIS is called.
The analysis calculations are performed on captured data. The apgLoadPort CAPTURE
BUFFERcommand enables capture on the port, and captures until the capture buffer is full.
The captured data is then downloaded and processed automatically. Only packets that match
the timestamp identifier TSID are processed. The TIMESTAMPID field is ignored if no TSID
value is set.
The latency measurements are stored in the local database, containing:
Packet latency measurements can be read using apgGetPort ANALYSIS.
8.2 GET PORT DATA - APGGETPORT
apgGetPort returns the variable value if successful, otherwise the command will display an
error message and exit the TCL environment.
8.2.1 apgGetPort [PORTID] INFO [VAR]
The port information can be read using the apgGetPort INFO command.
The apgGetPort INFO command must be preceded by at least one apgLoadPort INFO,
otherwise the command will display an error message and exit the TCL environment.
Port information is relatively static during a test and should only need to be read once at the
start of the test, or if the port transceiver or topology is changed.
APG-TCL-UG-V1-0 32 7 June 2017
Page 33
Ethernet Packet Generator
[VAR]
LENGTH
DESCRIPTION
TOPOLOGY_CAP
16 bits
Port topology capabilities:
Bit 0-7 = Reserved
Bit 8 = Blocked (0x0100)
Bit 9 = 1Gbps (0x0200)
Bit 10 = Reserved
Bit 11 = 10Gbps (0x0800)
Bit 12 = 4x10Gbps (0x1000)
Bit 13 = 40Gbps (0x2000)
Bit 14-15 = Reserved
NSUBPORTS
8 bits
Number of subports associated with the port
NSTREAMS
8 bits
Maximum number of streams that can be configured on
the port
NFILTERS
8 bits
Maximum number of filters that can be configured on the
port
TCL API GUIDE
APG-TCL-UG-V1-0 33 7 June 2017
Page 34
Ethernet Packet Generator
[VAR]
LENGTH
DESCRIPTION
LINK
8 bits
0 = No Link
1 = Link OK
MODULE_STATUS
8 bits
Bit 0 = Not Present
Bit 1 = Module Present
Bit 2 = Module Fault
Bit 3 = LOS
Bit 4 = Transmit Enable
Bit 5 = Rate Select 0
Bit 6 = Rate Select 1
Bit 7 = Reserved
SPEED
16 bits
Bit 0 = 10Mbps
Bit 1 = 100Mbps
Bit 2 = 1Gbps
Bit 3 = 10Gbps
Bit 4 = 40Gbps
Bit 5 = 100Gbps
Bit 6 = 4x10Gbps
Bit 7-15 = Reserved
Note that SPEED returns the expected port speed if the
link is down, and the actual port speed if the link is up.
SPEED_ABILITY
16 bits
Bit 0 = 10Mbps
Bit 1 = 100Mbps
Bit 2 = 1Gbps
Bit 3 = 10Gbps
Bit 4 = 40Gbps
Bit 5 = 100Gbps
Bit 6 = 4x10Gbps
Bit 7-15 = Reserved
MODULE_SEQUENCE
16 bits
Module Sequence ID → Number of times a module has
been inserted. Used to determine whether the module
has changed.
MODULE_TYPE
8 bits
0 = No Module
1 = SFP/SFP+
2 = QSFP+
MODULE_CLASS
8 bits
0 = None
1 = Fibre
2 = Copper
3 = Passive Direct Attach
4 = Active Direct Attach
MODULE_TEMP
16 bits
Module Temperature (°C)
Measured in 1/256ths of a degree. (ie divide by 256 to
get measured temperature)
TCL API GUIDE
8.2.2 apgGetPort [PORTID] STATUS [VAR]
The port status can be read using the apgGetPort STATUS command.
The apgGetPort STATUS must always be preceded by at least one apgLoadUnit
PORTSTATUS, otherwise the command will display an error message and exit the TCL
environment.
The apgGetPort STATUS is dynamic during a test as the link status changes, and should
always be preceded by apgLoadUnit PORTSTATUS
APG-TCL-UG-V1-0 34 7 June 2017
Page 35
Ethernet Packet Generator
[VAR]
LENGTH
DESCRIPTION
LINKMODE
8 bits
Current MAC-to-Module PMA Link Mode:
Bit 0 = 1000Base-X (SFP+ Port only)
Bit 1 = SGMII (SFP+ Port only)
Bits 3-4 = Reserved
Bit 5 = SRLR (QSFP+ only)
Note that the unit software will automatically choose the
preferred link mode based on the transceiver, but can be
over-written by the user.
LINKMODE_CAP
8 bits
MAC-to-Module PMA Link Mode Capabilities:
Bit 0 = 1000Base-X (SFP+ Port only)
Bit 1 = SGMII (SFP+ Port only)
Bits 3-4 = Reserved
Bit 5 = SRLR (QSFP+ only)
TIMESTAMPID
32 bits
Timestamp ID field
PORTNAME
12 char
Port Name
[VAR]
LENGTH
DESCRIPTION
MODULE_TYPE
8 bits
0 = No Module
1 = SFP/SFP+
2 = QSFP+
ID
96 chars
Serial ID Fields
VENDOR_ID
32 chars
Vendor-Specific ID field
[VAR]
LENGTH
DESCRIPTION
VENDOR_NAME
16 char
Manufacturer
VENDOR_PN
16 char
Manufacturer's Part Number
VENDOR_REV
4 char
Manufacturer's Revision
VENDOR_SN
16 char
Manufacturer's Serial Number
DATECODE
64 bits
Manufacturing Date
TCL API GUIDE
8.2.3 apgGetPort [PORTID] MODULE [VAR]
The module information can be read using the apgGetPort MODULE command.
The apgGetPort MODULE must always be preceded by at least one apgLoadPort MODULE,
otherwise the command will display an error message and exit the TCL environment.
The apgGetPort MODULE is dynamic during a test as the link status changes, and should
always be preceded by apgLoadPort MODULE.
The following fields are extracted from the ID Fields:
APG-TCL-UG-V1-0 35 7 June 2017
Page 36
Ethernet Packet Generator
Eg:
# Instantiate APG TCL API (Windows)
source "C:/Program Files/Axtrinet/APG/axtrinetApi.tcl"
# Open Connection
set IPADDRESS 192.168.1.100
set UNITID [apgOpen $IPADDRESS]
set PORTLIST {{$UNITID 1 0} {$UNITID 2 0}}
Open
Connection
# Port Counters
puts "\nDEMO: Display Port Counters"
apgLoadUnit $UNITID COUNTERS
foreach PORTID $PORTLIST {
scan $PORTID "%d %d %d" UN PO SP
set TXPKT [apgGetPort $PORTID TXSTATS GOOD_PACKETS]
set TXRATE [expr [apgGetPort $PORTID RATES TXBITRATE] / 1000000.0]
set RXPKT [apgGetPort $PORTID RXSTATS GOOD_PACKETS]
if { $TXPKT > 0 } {
puts [format " Port %2d TX %7d at %8.2f Mbps, RX %7d packets" \
$PO $TXPKT $TXRATE $RXPKT]
}
}
Counters
Load
Get counters
# Close connection
apgClose $UNITID
Close
connection
[VAR]
LENGTH
DESCRIPTION
TIMESTAMP
32 bits
Time that the transmit counters are read
BYTES
64 bits
Number of transmitted bytes
GOOD_PACKETS
64 bits
Number of good packets transmitted
PKT_64
32 bits
Count of 64 byte packets transmitted
PKT_65_128
32 bits
Count of 65-128 byte packets transmitted
PKT_129_256
32 bits
Count of 129-256 byte packets transmitted
PKT_257_512
32 bits
Count of 257-512 byte packets transmitted
PKT_513_1024
32 bits
Count of 513-1024 byte packets transmitted
PKT_1025_1536
32 bits
Count of 1025-1536 byte packets transmitted
PKT_1537_9000
32 bits
Count of 1537-9000 byte packets transmitted
PKT_9001_MAX
32 bits
Count of >9001 byte packets transmitted
TX_RUNTIME
32 bits
Time in seconds since the transmit command was sent
TCL API GUIDE
8.2.4 apgGetPort [PORTID] TXSTATS [VAR]
The transmit counters are read with the apgGetPort TXSTATS command.
The apgGetPort TXSTATS must always be preceded by at least one apgLoadUnit
COUNTERS, otherwise the command will display an error message and exit the TCL
environment.
The apgGetPort TXSTATS will change during a test, and should always be preceded by a
apgLoadUnit COUNTERS command. If the counters are not re-loaded, apgGetPort
TXSTATS will return the previous values.
APG-TCL-UG-V1-0 36 7 June 2017
Page 37
Ethernet Packet Generator
[VAR]
LENGTH
DESCRIPTION
TIMESTAMP
32 bits
Time that the receive counters are read
BYTES
64 bits
Number of received bytes
GOOD_PACKETS
64 bits
Number of good packets received
PKT_UNDERSIZE
32 bits
Number of under-sized (<64 Bytes) packets received
PKT_FRAGMENTS
32 bits
Number of packets fragments received
PKT_FCSERROR
32 bits
Number of packets received with Frame Checksum (FCS)
Errors
PKT_NOSFD
32 bits
Number of packets received without a valid Start-ofFrame Delimiter (SFD)
PKT_64
32 bits
Count of 64 byte packets received
PKT_65_128
32 bits
Count of 65-128 byte packets received
PKT_129_256
32 bits
Count of 129-256 byte packets received
PKT_257_512
32 bits
Count of 257-512 byte packets received
PKT_513_1024
32 bits
Count of 513-1024 byte packets received
PKT_1025_1536
32 bits
Count of 1025-1536 byte packets received
PKT_1537_9000
32 bits
Count of 1537-9000 byte packets received
PKT_9001_MAX
32 bits
Count of >9001 byte packets received
FILTER1
32 bits
Packets matched by Filter 1
FILTER2
32 bits
Packets matched by Filter 2
FILTER3
32 bits
Packets matched by Filter 3
FILTER4
32 bits
Packets matched by Filter 4
TCL API GUIDE
8.2.5 apgGetPort [PORTID] RXSTATS [VAR]
The receive counters are read with the apgGetPort RXSTATS command.
The apgGetPort RXSTATS must always be preceded by at least one apgLoadUnit
COUNTERS, otherwise the command will display an error message and exit the TCL
environment.
The apgGetPort RXSTATS will change during a test, and should always be preceded by a
apgLoadUnit COUNTERS command. If the counters are not re-loaded, apgGetPort
RXSTATS will return the previous values.
APG-TCL-UG-V1-0 37 7 June 2017
Page 38
Ethernet Packet Generator
[VAR]
LENGTH
DESCRIPTION
TXPKTRATE
32 bits
Transmit Packet Rate (packets/sec)
TXBYTERATE
64 bits
Transmit Byte Rate (Bytes/sec)
Derived from the Transmit BYTE count
TXBITRATE
64 bits
Transmit Bit Rate (Bits/sec)
Bits on the wire, including Inter-Frame Gap (IFG) and
Start-of-Frame (SFD) delimiter.
RXPKTRATE
32 bits
Receive Packet Rate (packets/sec)
RXERRORRATE
32 bits
Receive FCS Errored Packet Rate (packets/sec).
Divide the returned value by 16384 to get the FCS
errored packets per second.
RXBYTERATE
64 bits
Receive Byte Rate (Bytes/sec)
Derived from the Receive BYTE count
RXBITRATE
64 bits
Receive Bit Rate (Bits/sec)
Bits on the wire, including Inter-Frame Gap (IFG) and
Start-of-Frame (SFD) delimiter.
TCL API GUIDE
8.2.6 apgGetPort [PORTID] RATES [VAR]
The transmit and receive data rates are read with the apgGetPort RATES command.
apgGetPort RATES must always be preceded by at least one apgLoadUnit RATES,
otherwise the command will display an error message and exit the TCL environment.
apgGetPort RATES will change during a test, and should always be preceded by a
apgLoadUnit RATES command. If the rates are not re-loaded, apgGetPort RATES will
return the previous values.
APG-TCL-UG-V1-0 38 7 June 2017
Page 39
Ethernet Packet Generator
Eg:
# Instantiate APG TCL API (Windows)
source "C:/Program Files/Axtrinet/APG/axtrinetApi.tcl"
# Open Connection
set IPADDRESS 192.168.1.100
set UNITID [apgOpen $IPADDRESS]
set PORTLIST {{$UNITID 1 0} {$UNITID 2 0}}
Open
Connection
# Capture Control
puts "\nDEMO: Generating Packets"
Read the capture configuration, buffer and available memory sizes.
apgGetPort CAPTURE CONFIG must always be preceded by at least one apgLoadPort
CAPTURE CONFIG, otherwise the command will display an error message and exit the TCL
environment.
apgGetPort CAPTURE CONFIG will change while the capture buffer is filling, and should
always be preceded by a apgLoadPort CAPTURE CONFIG command.
Packet capture is controlled with the apgControlPort PORTCAPTURE, apgControlPort
DISABLECAPTURE, apgControlPort CLEARCAPTURE commands to start, stop and clear the
capture buffer.
The capture buffer is loaded using apgLoadPort CAPTURE BUFFER, and read using
apgGetPort CAPTURE PACKET.
APG-TCL-UG-V1-0 39 7 June 2017
Page 40
Ethernet Packet Generator
[VAR]
LENGTH
DESCRIPTION
RXTIME
64 bits
Receive timestamp of packet [PKTNUM] measured in 8ns
intervals since the unit was turned on.
TSMODE
4 bits
Receive Timestamp Flag of packet [PKTNUM]
0xA = Approximated timestamp
Anything else = Actual timestamp.
LENGTH
16 bits
Length of packet [PKTNUM]
PKTERROR
1 bit
Packet Error Flag of packet [PKTNUM]:
0 = OK
1 = FCS Error
DATA
[String]
Captured data of packet [PKTNUM]
Packet format is space-separated integers
[VAR]
LENGTH
DESCRIPTION
IDFIELD
32 bits
ID Field extracted from packet [PKTNUM]
Bytes [LENGTH]-19 to [LENGTH]-16
SEQNUM
32 bits
Sequence Number extracted from packet [PKTNUM]
Bytes [LENGTH]-15 to [LENGTH]-12
TXTIME
64 bits
Transmit timestamp extracted from packet [PKTNUM]
Bytes [LENGTH]-11 to [LENGTH]-4, measured in 8ns intervals
since the unit was turned on.
DELTA
32 bits
Latency of packet [PKTNUM], calculated by [TSRX]–[TSTX]
measured in 8ns ticks.
WARNING: ID, SEQ and TXTIME field are extracted on every captured
packet, regardless of the validity of the received packet. Care must be
taken to ensure that the receive packets contain the expected data before
further processing the information.
Read the capture packet data, where [PKTNUM] is the packet number in the capture buffer in
the range 1 to [TOTALPACKETS].
The capture configuration is loaded with apgLoadPort [PORTID] CAPTURE BUFFER.
The following variables are also valid if the TIMESTAMP_CONTROL is enabled (see Section
9.2.4) the transmitting stream:
Packet capture is enabled with apgControlPort PORTCAPTURE command.
The amount of data available for download can be monitored using the apgLoadPort
CAPTURE BUFFER and apgGetPort CAPTURE PACKET TOTALPACKETS to get the total
number of captured packets.
APG-TCL-UG-V1-0 40 7 June 2017
Page 41
Ethernet Packet Generator
[TYPE]
DESCRIPTION
TXTX
Transmit-to-transmit timestamp calculations
TXRX
Transmit-to-receive timestamp calculations
RXRX
Receive-to-receive timestamp calculations
SEQUENCE
Sequence Number status
[VAR]
DESCRIPTION
CYCLES
Number of capture cycles to collect samples
SAMPLES
Number of processed latency samples
LIST
List of processed timing deltas
MIN
Minimum latency, measured in 8ns ticks
MAX
Maximum latency, measured in 8ns ticks
MEAN
Mean latency, measured in 8ns ticks
MODE
Mode latency, measured in 8ns ticks
STDDEV
Standard Deviation, measured in 8ns ticks
[VAR]
DESCRIPTION
CYCLES
Number of capture cycles to collect samples
SAMPLES
Number of processed SEQ samples
LIST
List of processed SEQ samples
MIN
Minimum SEQNUM from sample
MAX
Maximum SEQNUM from sample
RANGE
SEQNUM range from sample
MONOTONIC
1=Monotonic 0=Not Monotonic
RPTCOUNT
Repeated Counter, increments if SEQn has been seen before
GAPCOUNT
Gap Counter, increments if SEQn > SEQ
n-1
+ 1
OOOCOUNT
Out-of-Order Counter, increments if SEQn < SEQ
max
TCL API GUIDE
8.2.10 apgGetPort [PORTID] ANALYSIS [TYPE] [VAR]
The latency measurements are read with the apgGetPort ANALYSIS command.
apgGetPort ANALYSIS must always be preceded by at least one apgLoadPort ANALYSIS,
otherwise the command will display an error message and exit the TCL environment.
If the measurements are not re-calculated, apgGetPort ANALYSIS will return the previous
values.
If [TYPE] is TXRX, TXTX or RXRX, the following [VAR] are available:
If [TYPE] is SEQUENCE, the following [VAR] are available:
APG-TCL-UG-V1-0 41 7 June 2017
Page 42
Ethernet Packet Generator
apgLoadPort
LOCAL ‘PORT’
DATABASE
apgGetPort
apgApplyPort
apgSetPort
[VAR]
Description
Default
TXENABLE
0 = Module Disabled
1 = Module Enabled
0x1
RATE
[RATE SELECT 1][RATE SELECT 0]
0 = RS1 & RS0 Not Set (low speed operation)
1 = RS1 Not Set, RS0 Set
2 = RS1 Set, RS0 Not Set
3 = RS1 & RS0 Set (high speed operation)
Note: Both bits should normally be set high for
10Gbps operation, although some vendor's
transceivers do not meet the SFP MSA guidelines.
Check vendor's recommended settings in the
datasheet.
apgSetPort returns the set value if successful, otherwise the command will display an error
message and exit the TCL environment.
8.3.1 apgSetPort [PORTID] [VAR] [VAL]
The apgSetPort command allows configuration of the transceiver inserted into the port, and
must be followed with apgApplyPort STATE to apply the port configuration onto the unit.
The [VAR] and [VAL] fields can be:
APG-TCL-UG-V1-0 42 7 June 2017
Page 43
Ethernet Packet Generator
apgLoadPort
LOCAL ‘PORT
DATABASE
apgGetPort
apgApplyPort
apgSetPort
TCL API GUIDE
8.4 APPLY PORT CONFIGURATION - APGAPPLYPORT
apgApplyPort returns 1 if successful, otherwise the command will display an error message
and exit the TCL environment.
8.4.1 apgApplyPort [PORTID] STATE
The apgApplyPort STATE command must be used after apgSetPort command to apply the
configuration changes to the unit.
APG-TCL-UG-V1-0 43 7 June 2017
Page 44
Ethernet Packet Generator
STATE
Description
STOPPED
Traffic generation stopped.
Stream configuration is loaded into the port traffic generator when a
STARTTX or STEPTX is issued.
Port transmit counters are stopped, although the port receive counters
may still be counting if the port is receiving traffic.
TRANSMITTING
The port is generating traffic, and remains in this state until a STOPTX,
PAUSETX or STEPTX command is issued.
If all of the enabled streams are generating fixed burst length
traffic, the port will stop transmitting when all streams have
transmitted the BURST LENGTH number of packets and move
to the STOPPED state.
A STEPTX command transmits the next packet, then PAUSES.
Issuing a second STARTTX has no effect.
PAUSED
Traffic generation is stopped.
Transmission continues when a STARTTX or STEPTX command is
issued, without loading a new stream configuration.
The PAUSE state is useful for interrupting a continuous stream
to allow the test data to settle and read the counters.
STEP
Transmit the next packet from the stream queue. The port immediately
returns to the PAUSED state.
Eg:
# Instantiate APG TCL API (Windows)
source "C:/Program Files/Axtrinet/APG/axtrinetApi.tcl"
← Load API
# Open Connection
set IPADDRESS 192.168.1.100
set UNITID [apgOpen $IPADDRESS]
set PORTLIST {{$UNITID 1 0} {$UNITID 2 0}}
Open
Connection
# Port Transmit & Capture Control
puts "\nDEMO: Generating Packets for 3 seconds"
Total frame length (including FCS) in bytes.
If SIZE_MODE is not 0 (FIXED), FRAME_SIZE defines the
minimum frame length for the increment, decrement or
random size.
PACKET_SIZE_MAX
32 bits
Maximum frame length (including FCS) in bytes for the
increment, decrement or random size modes.
If SIZE_MODE is 0 (FIXED) this value is ignored.
TCL API GUIDE
9.2.1 apgGetStream [STREAMID] CONFIG [VAR]
The stream configuration status, rate and size information is read with the apgGetStream
CONFIG command.
apgGetStream CONFIG must either be configured using apgSetStream CONFIG or be
preceded by at least one apgLoadStream. If [VAR] has not been defined, apgGetStream
CONFIG will display an error message and exit the TCL environment.
APG-TCL-UG-V1-0 49 7 June 2017
Page 50
Ethernet Packet Generator
Variable
Description
[VAL]
Initial Value
[MODE]
The header field modes are defined in the Header Definition document [3].
For example, the MACHEADER DA modes are "FIX INC" where:
FIX
Fixed [FLD] value [VAL]
INC
Incrementing [FLD] value [VAL], starting at [VAL] with each
byte incrementing to [MAX], wrapping to [MIN] to continue
incrementing
[MIN]
Minimum range for INC [FLD] value wraps to [MAX] in decrementing
mode.
[STEP]
Byte-wise step
[MAX]
Maximum range for INC .
[FLD] value wraps to [MIN] (zero) in incrementing mode.
TCL API GUIDE
9.2.2 apgGetStream [STREAMID] HEADER HEADER_LIST
Returns a list of configured header names in the order that the headers appear in the frame.
apgGetStream HEADER HEADER_LIST must either be configured using apgSetStream
HEADER HEADER_LIST or be preceded by at least one apgLoadStream. If [VAR] has not
been defined, apgGetStream HEADER HEADER_LIST will display an error message and exit
the TCL environment.
For example, the minimum set of ethernet headers is:
MACHEADER ETHERNET_II USERDEFINED
The full list of headers is defined in the latest Header Definition document [3].
For example: A header structure containing a MAC Header [MACHEADER] and an Ethertype
[ETHERNET-II] will return "MACHEADER ETHERNET-II"
The maximum number of headers in the header list is 10.
The maximum length of the headers is 64 bytes.
9.2.3 apgGetStream [STREAMID] HEADER [HDR] [FLD]
Returns the value of a header field configuration.
apgGetStream HEADERmust either be configured using apgSetStream HEADER or be
preceded by at least one apgLoadStream. If [FLD] has not been defined, apgGetStream
HEADERwill display an error message and exit the TCL environment.
The returned value depends on the configuration mode (FIX, INC etc).
apgGetStream HEADER returns a single value if [MODE] is FIXed.
apgGetStream HEADER returns a list if [MODE] is not FIXed, containing the following fields:
"[VAL] [MODE] [MIN] [STEP] [MAX]"
Where:
The full list of [HDR] headers is defined in the latest Header Definition document [3].
The header fields [FLD] for the basic set of ethernet headers are shown below as examples.
The full list of headers is defined in the latest Header Definition document [3].
APG-TCL-UG-V1-0 50 7 June 2017
Page 51
Ethernet Packet Generator
Format
Minimum
Maximum
Comments
MAC-ADDRESS
00:00:00:00:00:00
FF:FF:FF:FF:FF:FF
HEX4
0x0
0xFFFF
HEX2ARRAY
0x0
0xFF
Variable length HEX2 values
separated by spaces
[FLD]
DESC
SIZE
FORMAT
MODE
DA
MAC Destination Address
6 bytes
MAC-ADDRESS
FIX INC
SA
MAC Source Address
6 bytes
MAC-ADDRESS
FIX INC
[FLD]
DESC
SIZE
FORMAT
MODE
ETHERTYPE
Ethernet-II Type
2 bytes
HEX4
FIX INC
[FLD]
DESC
SIZE
FORMAT
MODE
DATA
Data Values
Variable
HEX2ARRAY
--
[VAR]
LENGTH
Description
PAYLOAD_DATA
12 Char
Payload values
DATA_CONTROL
8 bits
FIXED, RANDOM, INCREMENT, DECREMENT
apgGetStream HEADERreturns the variable value in the following formats:
9.2.3.1 MACHEADER
9.2.3.2 ETHERNET_II
TCL API GUIDE
9.2.3.3 USERDEFINED
The USERDEFINED header is a variable length configurable field that can be used to implement
any fixed custom header field.
9.2.4 apgGetStream [STREAMID] PAYLOAD [VAR]
Returns the value of the payload fields.
apgGetStream PAYLOADmust either be configured using apgSetStream PAYLOAD or be
preceded by at least one apgLoadStream. If [VAR] has not been defined, apgGetStream
PAYLOAD will display an error message and exit the TCL environment.
APG-TCL-UG-V1-0 51 7 June 2017
Page 52
Ethernet Packet Generator
apgLoadStream
LOCAL ‘STREAM’
DATABASE
apgGetStream
apgApplyStream
apgSetStream
Eg:
# Instantiate APG TCL API (Windows)
source "C:/Program Files/Axtrinet/APG/axtrinetApi.tcl"
← Load API
# Open Connection
set IPADDRESS 192.168.1.100
set UNITID [apgOpen $IPADDRESS]
set PORTLIST {{$UNITID 1 0} {$UNITID 2 0}}
Open
Connection
# Configure Streams
puts "\nDEMO: Configure Streams"
set STREAM 0
foreach PORTID $PORTLIST {
scan $PORTID "%d %d %d" UN PO SP
puts " -> Port $PO"
for { set ST 0 } { $ST < 8 } { incr ST } {
set STREAMID [linsert $PORTID end $ST]
if { $ST == 0 } {
apgSetStream $STREAMID DEFAULT
apgSetStream returns the set value if successful, otherwise the command will display an
error message and exit the TCL environment.
A stream configuration is made up of three parts:
apgSetStream CONFIG
apgSetStream HEADER
apgSetStream PAYLOAD
All three parts have to be correctly defined to successfully configure a stream.
It is recommended that a default stream is created using apgSetStream DEFAULT to ensure
that all of the variables correctly are defined, then modifying the default configuration.
The stream configuration is applied to the unit using apgApplyStream.
APG-TCL-UG-V1-0 52 7 June 2017
Page 53
Ethernet Packet Generator
[VAR]
Description
Default
FORMAT
ENABLE
0 = Stream Disabled
1 = Stream Enabled
0
HEX2
TX_MODE
CONTINUOUS (0)
BURST (1)
MULTIBURST (2)
CONTINUOUS
TX_BURST_SIZE
Number of frames in the burst
1
INT
TX_BURST_COUNT
Number of bursts to transmit
1
INT
TX_IBG
Inter-burst gap (x5.5ns)
0
INT
RATE_MODE
TXGAP Pseudo-IPG at internal clock
frequency
PPS Packets per Second
PERCENT % maximum bit rate
TXGAP
RATE_VALUE
If RATE_MODE = TXGAP
→ TXGAP = RATE_VALUE * 8 bytes * link
speed
FIXED = Fixed PACKET_SIZE byte packets
RANDOM = Random length packets between
PACKET_SIZE and PACKET_SIZE_MAX
bytes.
If PACKET_SIZE_MAX is not defined, fixed
length PACKET_SIZE byte packets will be
generated.
FIXED
PACKET_SIZE
Total packet length (including FCS) in bytes.
If SIZE_MODE is not 0 (FIXED), FRAME_SIZE
defined the minimum frame length for the
increment, decrement or random size.