Spirent Test Center Automation Prog Guide
Spirent Test Center Automation Prog Guide
Copyright
© 2007 Spirent Communications, Inc. All Rights Reserved.
All of the company names and/or brand names and/or product names referred to in this document, in particular, the
name “Spirent” and its logo device, are either registered trademarks or trademarks of Spirent plc and its subsidiaries,
pending registration in accordance with relevant national laws. All other registered trademarks or trademarks are the
property of their respective owners. The information contained in this document is subject to change without notice
and does not represent a commitment on the part of Spirent Communications. The information in this document is
believed to be accurate and reliable, however, Spirent Communications assumes no responsibility or liability for any
errors or inaccuracies that may appear in the document.
Limited Warranty
Spirent Communications, Inc. (“Spirent”) warrants that its Products will conform to the description on the face of
order, that it will convey good title thereto, and that the Product will be delivered free from any lawful security interest
or other lien or encumbrance.
Spirent further warrants to Customer that hardware which it supplies and the tangible media on which it supplies
software will be free from significant defects in materials and workmanship for a period of twelve (12) months, except
as otherwise noted, from the date of delivery (the “Hardware Warranty Period”), under normal use and conditions.
To the extent the Product is or contains software (“Software”), Spirent also warrants that, if properly used by Customer
in accordance with the Software License Agreement, the Software which it supplies will operate in material
conformity with the specifications supplied by Spirent for such Software for a period of ninety (90) days from the date
of delivery (the “Software Warranty Period”). The “Product Warranty Period” shall mean the Hardware Warranty
Period or the Software Warranty Period, as applicable. Spirent does not warrant that the functions contained in the
Software will meet a specific requirement or that the operation will be uninterrupted or error free. Spirent shall have no
warranty obligations whatsoever with respect to any Software which has been modified in any manner by Customer or
any third party.
Defective Products and Software under warranty shall be, at Spirent's discretion, repaired or replaced or a credit issued
to Customer's account for an amount equal to the price paid for such Product provided that: (a) such Product is
returned to Spirent after first obtaining a return authorization number and shipping instructions, freight prepaid, to
Spirent's location in the United States; (b) Customer provides a written explanation of the defect or Software failure
claimed by Customer; and (c) the claimed defect actually exists and was not caused by neglect, accident, misuse,
improper installation, improper repair, fire, flood, lightning, power surges, earthquake, or alteration. Spirent will ship
repaired Products to Customer, freight prepaid, based on reasonable best efforts after the receipt of defective Products.
Except as otherwise stated, any claim on account of defective materials or for any other cause whatsoever will
conclusively be deemed waived by Customer unless written notice thereof is given to Spirent within the Warranty
Period. Spirent reserves the right to change the warranty and service policy set forth above at any time, after
reasonable notice and without liability to Customer.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, ALL IMPLIED WARRANTIES, INCLUDING BUT
NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS
FOR A PARTICULAR PURPOSE, ARE HEREBY EXCLUDED, AND THE LIABILITY OF SPIRENT, IF ANY,
FOR DAMAGE RELATING TO ANY ALLEGEDLY DEFECTIVE PRODUCT SHALL BE LIMITED TO THE
ACTUAL PRICE PAID BY THE CUSTOMER FOR SUCH PRODUCT. THE PROVISIONS SET FORTH ABOVE
STATE SPIRENT'S ENTIRE RESPONSIBILITY AND CUSTOMER'S SOLE AND EXCLUSIVE REMEDY WITH
RESPECT TO ANY BREACH OF ANY WARRANTY.
Contents
About this Guide. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Related Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
How to Contact Us . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Spirent TestCenter API Syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Object, Attribute, and Relation References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Spirent TestCenter Automation API Functions . . . . . . . . . . . . . . . . . . . . . . . 19
Chassis Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Chassis Connection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
The PhysicalChassisManager Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Module Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Chassis Disconnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Spirent TestCenter Script Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Return Status and Error Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Test Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Chassis Connection, Port Reservation and Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Text Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Script Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
The Spirent TestCenter Command Sequencer . . . . . . . . . . . . . . . . . . . . . . . . 65
Using the Sequencer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Sequencer Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Sequencer / Command States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Sequencer Example (Basic) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Sequencer Example (Advanced). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Spirent TestCenter Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Paged Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
End-of-Test Results Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Packet Generator and Analyzer – Ethernet, IP, TCP, and UDP . . . . . . . . . . 113
PGA Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Using Spirent TestCenter Automation for PGA Tests . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Packet Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Test Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Point-to-Point Protocol over Ethernet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
PPPoE Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Using Spirent TestCenter Automation for PPPoE Tests . . . . . . . . . . . . . . . . . . . . . . . . 142
PPPoE Example (Tcl) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Unicast Routing - Border Gateway Protocol (BGP). . . . . . . . . . . . . . . . . . . 173
BGP Test Configuration Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
• Related Documentation . . . . 7
• How to Contact Us . . . . 8
Introduction
This manual provides information about the Spirent TestCenter Automation API syntax
and functions. It also provides descriptions of how to use the API along with examples of
creating and running test configurations.
This manual is intended for users who wish to use the Spirent TestCenter Automation API
to perform tests using the features of one of the Spirent TestCenter Automation packages
(such as the Multicast base package or the RFC 2544 test package). It is assumed that
users of this manual have the following knowledge and experience:
• Familiarity with the operating system environment on your PC or workstation
(Microsoft® Windows® or Linux®/Unix®).
• Moderate familiarity with Spirent TestCenter equipment
• Working knowledge of data communications theory and practice
• Ability to program with the Tcl scripting language.
The following table provides a brief description of the sections in this manual.
Spirent TestCenter API Syntax Provides information about the API syntax.
Spirent TestCenter Script Template Provides an example script that demonstrates the basic
elements that every Spirent TestCenter Automation
script uses to create and run tests.
The Spirent TestCenter Command Sequencer Describes the Spirent TestCenter Sequencer and
provides Tcl examples of using the Sequencer.
Packet Generator and Analyzer – Ethernet, IP, Describes how to write scripts to generate and analyze
TCP, and UDP network traffic.
Point-to-Point Protocol over Ethernet Provides information about using Spirent TestCenter
Automation to test PPPoE, including a Tcl example that
creates a PPPoE test configuration and runs the test.
Unicast Routing - Border Gateway Protocol Describes how to use Spirent TestCenter Automation to
(BGP) test BGP, including a Tcl example that creates a BGP
test configuration and runs the test.
Related Documentation
Additional documentation items that are related to this manual are listed below.
• Spirent TestCenter Automation Object Reference. Contains reference information
about the objects in the Spirent TestCenter data model.
• Spirent TestCenter Automation Programmer’s Guide. Describes the Spirent
TestCenter Automation functions and contains information about using the API to
write Tcl scripts for specific protocols and particular elements of network
performance testing.
• External Time Reference (GPS/CDMA) User Guide. Describes the GPS/CDMA kits
available from Spirent Communication, explains GPS/CDMA theory of operation,
and describes how to set up GPS/CDMA for use with Spirent TestCenter and
SmartBits equipment.
• Getting Started with Spirent TestCenter. Provides details on how to install Spirent
TestCenter chassis and modules and how to obtain license keys.
• Spirent TestCenter System Reference Manual. Describes the Spirent TestCenter
chassis, modules, accessories, and software applications. General information is also
provided on system administration functions, testing procedures, and diagnostics.
In addition to these manuals, all Spirent TestCenter software applications include detailed,
context-sensitive online Help systems.
A glossary of Spirent TestCenter terminology is available in each Spirent TestCenter
online Help file.
How to Contact Us
To obtain technical support for any Spirent Communications product, please contact our
Support Services department using any of the following methods:
Americas
E-mail: [email protected]
Web: http://support.spirentcom.com
Toll Free: +1 800-SPIRENT (+1 800-774-7368) (US and Canada)
Phone: +1 818-676-2616
Fax: +1 818-880-9154
Hours: Monday through Friday, 05:30 to 16:30, Pacific Time
Asia Pacific
E-mail: [email protected]
Web: http://support.spirentcom.com.cn
Phone: 400 810 9529 (mainland China)
Phone: +86 400 810 9529 (outside China)
Fax: +86 10 8233 0022
Hours: Monday through Friday, 09:00 to 18:00, Beijing Time
The latest versions of user manuals, application notes, and software and firmware updates
are available on the Spirent Communications Customer Service Center websites at
http://support.spirentcom.com and http://support.spirentcom.com.cn (China).
Information about Spirent Communications and its products and services can be found on
the main company websites at http://www.spirentcom.com and
http://www.spirentcom.com.cn (China).
Company Address
Spirent Communications, Inc.
26750 Agoura Road
Calabasas, CA 91302
USA
attributeReference attributeName – The name of an object attribute. To retrieve attribute values, specify the
object handle and one or more attribute names. Attribute names must start with a dash
character (–):
One of the following:
Examples:
attributeName
stc::get $port -location
or stc::get $port -active -location
attrNameValue attrNameValue – Attribute name-value pairs identify an object property and supply a
or value for that property. The attribute name must start with a dash character (–). The
attribute value is separated from the name by a space. In a sequences of name-value
DANpath [Value]
pairs, one pair is separated from the next by a space.
or
Example:
relationReference stc::config $port -active false -location "//10.1.1.1/1/1"
value A value may be an IP address, host name, chassis/slot/port tuple, integer, or a string
value.
Examples:
stc::connect //172.168.1.1
stc::reserve //172.168.1.1/1/1
stc::sleep 5
NOTES:
• Use the Spirent TestCenter namespace “stc” to identify Spirent TestCenter
Automation functions (for example, stc::create).
• Spirent TestCenter Automation functions names are case-sensitive. Function
names are specified using lower-case characters. Object and attribute names
are case-insensitive.
The call to the create function creates a StreamBlock object. Spirent TestCenter uses the
path specification in the attribute reference to create an additional object, in this case, an
EthernetII header object as a child of the newly created StreamBlock object. Spirent
TestCenter sets the etherType attribute when it creates the EthernetII object. For more
information about using path names, see Referencing Objects: Object Paths.
NOTE: In some circumstances, Spirent TestCenter will create objects on your behalf.
Each object description in the Spirent TestCenter Automation Object Reference lists the
associated automatic objects.
Spirent TestCenter Automation creates handles when it creates the objects in your object
hierarchy. When you call the create function, the object handle is the return value from the
function:
set project_handle [stc::create Project -name “BGPTest”]
When the create function returns, the variable project_handle is set to the value of the
object handle for the newly created Project object. Your application then uses the object
handle in other calls to Spirent TestCenter Automation functions.
In this example, the -under attribute specifies the Project object handle as the parent
for the new Port object. The create function returns the handle for the Port object;
you use this object handle as the parent for StreamBlock objects or other objects that
are children of a Port object.
• To gain access to object attributes. You provide a handle when you call get to retrieve
an attribute value, or when you call config to modify an attribute value. You may also
use handles when you execute a command with the perform function (if the command
requires access to an object).
In the example above, both -active and -location attribute values are applied to the Port
child of the $project object.
The call to the create function creates a StreamBlock object. The call also contains a
DAN path specification as part of the etherType attribute reference. Spirent TestCenter
uses the DAN path specification to create the objects identified in the attribute reference,
in this case, an EthernetII header object as a child of the newly created StreamBlock
object.
To identify one of multiple children of the same type, specify the index of the desired child
in parenthesis. The following examples show the use of indices in both DDN and DAN
paths.
stc::config $project.Port(2) -location “//mychassis1/1/2”
set enabled [stc::get $port1 \
-StreamBlock(2).enableControlPlane]
Relation References
Relations are connections between objects in your test configuration. For example,
relations are used to define the parent-child connection between objects, or to define the
connection between a stream and a port. When you create your test configuration, Spirent
TestCenter creates some relations on your behalf; in some cases, you create additional
relations to define additional connections.
A relation reference consists of a side name and an optional handle list:
-sideName [handleList]
-DANPath.sideName [handleList]
A side name is a single name that identifies both the relation and one side of the relation.
For example:
stc::get $port1 -children
The following sections provide more information about relation references.
Relation Definitions
A relation definition:
• Specifies two sides to the connection, identifying the object types that can be used as
sources and targets.
• Specifies side names. Use side names to reference the objects in a relation.
• For the parent-child relation, the side names are “parent” and “children.”
• See the relation tables in the object descriptions for additional side names defined
for particular relation types.
A relation reference includes a side name to indicate both the relation type and the side of
the relation. A side name specification can be one of the following:
-sideName
-DANPath.sideName
For example:
stc::get $port1 -children
stc::get $project -Port(1).children
stc::config $pppoeCBD -UsesIf "$ipv4If $pppoeIf"
When you use a relation reference in a call to the get function, Spirent TestCenter returns
one or more object handles. For example:
stc::get $port1 -children
This function call returns a list containing the object handles for all of the children of the
specified Port object.
When you use a relation to retrieve the handles of child objects, you can specify an object
type to filter the set of objects. Spirent TestCenter supports filtering of child relations only.
For example:
stc::get $port1 -children-StreamBlock
This function call returns the handle(s) for the StreamBlock child object(s) of the
$port1 object.
Modifying a Relation
When you modify a relation (change the object that is the source or target of a relation),
you provide one or more object handles for the specified side of the relation. To modify a
relation, use a side name and a list containing one or more handles:
-sideName handleList
-DANPath.sideName handleList
For example:
stc::config $port1 -affiliatedPortSource $host1
Although you can use relation references to modify a relation and to retrieve object
handles for remote objects defined by a relation, you cannot use a relation reference to get
or set an attribute for the resulting object(s). In order to manipulate attributes in a remote
object, you must first obtain the handle, then use the handle to directly access the attribute.
For example:
The first call to the get function retrieves the handle to the StreamBlock object at the
source side of the ExpectedRx relation. The second call retrieves the value of the State
attribute from the StreamBlock object.
You can also use the full specification of a relation reference. This form may be
deprecated at some time in the future. A full specification for a relation reference includes
both the relation type and the side of the relation:
-relationType-side
-DANPath-relationType-side
Specify the side of the relation (“sources” or “targets”) explicitly. For example:
stc::get $port1 -ParentChild-targets
stc::get $project -Port(1).ParentChild-targets
stc::config $pppoeCBC -UsesIf-targets "$ipv4If $pppoeIf"
It is easier to use the shorter, simpler side names in relation references. The side name
takes the place of a -relationType-side combination. For example:
stc::get $port1 -children
stc::config $pppoeCBD -UsesIf "$ipv4If $pppoeIf"
• apply • log
• config • perform
• connect • release
• create • reserve
• delete • sleep
• disconnect • subscribe
• get • unsubscribe
• help • waitUntilComplete
apply
Syntax apply
Comments The apply function sends a test configuration to the connected chassis (see the description
of the connect function). Spirent TestCenter applies those objects for which the value of
the active attribute is True. (An object active attribute is set to True by default.) Note that
if an object active attribute is set to False, Spirent TestCenter does not apply the
configuration for that object, and it does not apply any of its descendants either, regardless
of a descendant’s active setting.
If you are running your test by executing individual test steps, then you must apply your
test configuration before you execute any test steps (such as starting router
communication or starting traffic).You also use the apply function to activate any changes
that you have made to your test configuration. If you call apply when your test is
executing, Spirent TestCenter applies the configuration immediately, which will affect the
running test in real-time.
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
Example stc::apply
Parameters None.
config
Comments The config function sets or modifies the value of one or more object attributes. You can
also use the config function to modify relations. Note that if you attempt to modify an
attribute for a read-only object, the config function raises an exception.
• When you modify object attributes, use name-value pairs and specify the attribute
name with a dash (-) prefix. For example:
stc::config port1 -location 10.100.0.0/1/1
• You can use Direct Descendant Notation (DDN) to identify the object, and
Descendant Attribute Notation (DAN) to identify the attribute. For example:
stc::config $project.port -location "mychassis1/1/2"
stc::config $project -port.active false
A DDN path is a dotted path name sequence. The sequence begins with an object
handle, followed by one or more object type names. The path must identify a valid
sequence of objects in your test hierarchy.
A DAN path is a dotted path name beginning with a dash (–), followed by a sequence
of one or more object types, and ending with an attribute name. Spirent TestCenter
combines the handle (or the DDNPath) with the DANPath to resolve the attribute
reference. The path must identify a valid sequence of objects in your test hierarchy.
In both DDN and DAN paths, an object type name may have an index suffix (an
integer in parenthesis) to reference one of multiple children of the same type.
For more information about these notations, see Referencing Objects: Object Paths.
• When you modify a relation, you can set either the source or target of the relation. Use
a side name for the relation reference. A side name represents both the relation type
and the side of the relation (source or target). For example:
stc::config $port1 -AffiliatedPortSource router2
stc::config $port -children $stream1 $stream2 $stream3
The relation reference requires a handle list as a value. The handle list identifies one
or more objects for the referenced side of the relation. In the first example above, the
config statement sets router2 as the source of the AffiliationPort relation defined for
$port1. The second example establishes three StreamBlock children for $port.
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
Parameters
Parameter Type Description
-attr value name-value pair An attribute name-value pair. The -attr portion
of the pair is the name of the attribute to be
modified. The attribute name must start with a
dash (-). The value portion specifies the new
value. You can specify one or more name-value
pairs in a single function call. The attribute
name and value must be separated by a space;
each name-value pair in a sequence must be
separated by a space.
connect
Comments The connect function establishes a connection between the management system that is
running the Spirent TestCenter software and a Spirent TestCenter chassis. Spirent
TestCenter Automation uses port number 40004.
You can specify either an IP address or a Domain Name Service (DNS) host name.
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
Parameters
Parameter Type Description
create
Comments The create function creates one or more Spirent TestCenter Automation objects. When
you call the create function, you specify the type(s) of one or more objects to be created.
You can specify:
• An object type name (such as the Project object or the Port object). For example:
stc::create Project
stc::create Port -under $hProject
• An object type path. To specify a path name, use dotted notation. A path name is a
sequence of object types that form valid parent-child relationships in your test
hierarchy, extending from the object identified by handle. Spirent TestCenter creates
the set of objects specified in the path. In the following example, Spirent TestCenter
creates a Router object and a BGPRouterConfig object as its child.
stc::create Router.BGPRouterConfig -under $hPort
For information about path name specification, see Object, Attribute, and Relation
References.
Usually, when you create an object, you must specify the -under attribute to supply a
parent for the newly created object. (The Project object, shown in the syntax specification
above, is the exception to this rule.) The value of the -under attribute is the object handle
returned by the create call that created the parent object, or a handle retrieved by calling
get. The parent object must be the correct type for the object that you create. (If you
specify an object type path, the parent object must be the correct type for the first object
type in the path sequence.)
When you create an object, you can also set the object attributes at the same time. To set
attributes, specify one or more attribute name-value pairs.
• If you specify name-value pairs when you also specify an object type path, Spirent
TestCenter applies the attribute values to the object associated with the last name
specified in the object type path. In the following example, Spirent TestCenter creates
a Router object and a BGPRouterConfig object as a child of the newly created
Router object. When Spirent TestCenter creates the BGPRouterConfig object, it sets
the -initiate attribute to FALSE.
stc::create Router.BGPRouterConfig -under $hPort \
-initiate FALSE
• You can specify a Descendant Attribute Notation (DAN) path as part of the attribute
reference. Spirent TestCenter uses the specified object type to create the primary
object, and the DAN path to create any additional objects. The path must specify a
valid descendant path extending from the primary object. Spirent TestCenter will
create the primary object, the objects identified in the path, and then set the referenced
attribute of the last object in the path. In the following example, Spirent TestCenter
creates a Port object (the primary object), then the StreamBlock and EthernetII
objects. When Spirent TestCenter creates the EthernetII object, it also sets the
-etherType attribute.
stc::create Port -under $hProject \
-StreamBlock.ethernet:EthernetII.etherType 880B \
-frameconfig ""
For information about path name specification, see Object, Attribute, and Relation
References.
• When you create an object, you can also create a relation between the newly created
object and an existing object. In this case, you specify the object to be created, the
handle for its parent (handle1), a relation reference, and the handle for one or more
objects on the other side of the connection (handleList). In the following example,
Spirent TestCenter creates a Router object and establishes an AffiliatedPort relation
between the new Router object and an existing Port object.
set hRouter2 [stc::create Router -under $hProject \
-AffiliatedPort $hPort]
For information about specifying relations, see Relation References.
Return Value The create function returns a unique string value that is the object handle for the object
specified in the function call. (The create function returns only the handle for the primary
object that is created. To obtain the handles for any decendant objects that are created, use
the get function to retrieve the child objects.)
Parameters
Table 1-1.
Project string Specify the Project object type to create the root
of your test hierarchy. A Project object has no
parent, so you do not specify the -under attribute
in the function call.
-under handle handle Specifies the handle of the parent for the newly
(string) created object. The type of object that you create
must be appropriate for the parent object. You
must specify the -under attribute when you create
any object except the Project object.
When you specify an object type path, use the -
under attribute to specify the parent of the first
object type in the path.
Table 1-1.
delete
Comments Deletes the object identified by objectHandle. Spirent TestCenter also deletes all
descendants of the specified object (if any).
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
Parameters
Parameter Type Description
handle handle The object handle that identifies the object to be deleted.
disconnect
Comments The disconnect function removes an established connection between the management
system that is running the Spirent TestCenter software and a Spirent TestCenter chassis.
You can specify either an IP address or a Domain Name Service (DNS) host name. Note
that when you call disconnect, you must use the same type of value (address or name) that
you used in the call to connect.
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
Parameters
Parameter Type Description
get
Description Returns the value(s) of one or more object attributes or a set of object handles.
Comments The get function returns the value of one or more object attributes, or, in the case of
relation references, one or more object handles.
• The handle identifies the object from which data will be retrieved. If you do not
specify any attributes, Spirent TestCenter returns the values for all attributes defined
for the object. (Note that if you specify a DDN path, you must specify one or more
attributes.)
• The attributeName identifies an attribute for the specified object.
• The DANPath (Descendant Attribute Notation path) is is a dotted path name
beginning with a dash (–), followed by a sequence of one or more object types, and
ending with an attribute name. An object type name may have an index suffix (an
integer in parenthesis) to reference one of multiple children of the same type. Spirent
TestCenter combines the handle (or the DDNPath) with the DANPath to resolve the
attribute reference. The path must identify a valid sequence of objects in your test
hierarchy. For example:
stc::config $project -port.active false
Spirent TestCenter combines the object and attribute specifications to retrieve the
value of the active attribute for the first Port object child of $project.
• The DDNPath (Direct Descendant Notation path) is a dotted path name sequence. The
sequence begins with an object handle, followed by one or more object type names.
The path must identify a valid sequence of objects in your test hierarchy. When you
use DDN, you must specify one or more attributes. Spirent TestCenter returns data for
the object identified by the last name in the sequence. For example:
stc::get $port1.EthernetCopper -AutoNegotiation
In this case, Spirent TestCenter returns the value of the -AutoNegotiation attribute for
the first EthernetCopper child of the specified Port object.
If there is more than one instance of a particular object type as children of the
specified object, use index notation. (In the example above, the index value 1 is
implied.) Spirent TestCenter assigns index values in order of object creation. For
example:
stc::get $project.port(2)
Spirent TestCenter returns the attributes for the second Port object child of the
specified Project object.
• When you use a relation reference with the get function, it provides access to one or
more objects connected to the object identified by handle (or DDNPath). Specify a
side name for the relation reference, using one of the following relation-reference
formats:
-sideName
-DANPath.sideName
A side name represents both the relation type and the side of the relation (source or
target).
• When you use a relation to retrieve the handles of child objects, you can specify an
object type to filter the set of objects. Spirent TestCenter supports filtering of child
relations only. For example:
stc::get $port1 -children-StreamBlock
This function call returns the handle(s) for the StreamBlock child object(s) of the
$port1 object.
Return Value When you retrieve one or more attributes, get returns a string containing a single attribute
value or a set of name-value pairs. If you do not specify any attributes, the get function
can return either a single attribute value or a list of name-value pairs (depending on the
definition of the object).
When the get function returns a list of name-value pairs, Spirent TestCenter returns a
single string containing the list. Each attribute name and its value is separated by a space,
and the name-value pairs are separated by a space:
-attr1 value1 -attr2 value2 .. -attrN valueN
When you specify a relation reference, the get function returns one or more handles.
Errors are raised as exceptions encoded as string values describing the error condition.
Parameters
handle handle Identifies the object from which data will be retrieved.
relationRef string Specifies specifies the relation type and side of the
relation. The relation type must be defined for the
object referenced by handle or DDNPath.
The relation reference must start with a dash (–). The
relation type and side elements are separated by a dash
(–relationType–side). The relation reference can
include a DAN path (-DANPath.relationType-side).
relationRef can be a side name, which implies the
same information. For information about relation
syntax, see Relation References.
help
Description Displays help about the Spirent TestCenter Automation API and data model.
Syntax help
help commands
help command
help handle (documentation, not data)
help objectType
Comments The help function provides information about Spirent TestCenter Automation. You can
display the following type of information:
• An overview of the help that is available
(stc::help)
• An overview of the functions (create, config, etc.)
(stc::help commands)
• Information about a specific function or command
(stc::help command, for example – stc::help create or stc::help SaveAsTcl)
• Information about an object type
(stc::help handle or stc::help objectType, for example – stc::help $port or
stc::help Port)
Return Value None. (The function displays the results of the help request.)
Example stc::help
stc::help commands
stc::help create
stc::help SaveAsTcl
stc::help Port
Parameters
Parameter Type Description
handle handle Displays information about the object type for the
specified handle.
log
Comments The log function writes a diagnostic message to a log file or to standard output. Spirent
TestCenter Automation provides this function so that your application can insert a
message into the log file.
The log capability uses the values defined for the AutomationOptions object to
determine its behavior. By modifying the AutomationOptions attributes, you can:
• Set the default log level for system messages.
• Send the output to a file. (By default, messages are directed to standard output.)
• Suppress Tcl errors (change the error mechanism from raised exceptions to returned
errors).
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
Parameters
logLevel enum Identifies the severity of the message. The log level can be one
of the following:
INFO
WARN
ERROR
FATAL
These values correspond to the logLevel enumerated type
values defined for the AutomationOptions object.
perform
Comments The perform function executes a command. See the Spirent TestCenter Automation Object
Reference for a complete list of commands.
Return Value The perform function returns an array containing name-value pairs corresponding to the
complete set of attributes defined for the command object. The values are encoded as
strings. Errors are raised as exceptions encoded as string values describing the error
condition.
Parameters
Parameter Type Description
-parameter value string One or more name/value pairs that may be defined for the
command. The parameter names correspond to the names of
attributes defined for the command object.
release
Comments release terminates the reservation for one or more ports. The portList parameter specifies
one or more chassis-slot-port tuples. You can release only those ports that you have
reserved. For information about port reservations and the syntax for identifying ports, see
the description of the reserve function.
If a port is part of a port group, releasing the port will release all of the ports in the group.
Note that you must release every port that you have reserved. Failure to do this can put the
module(s) into a state that requires rebooting.
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
# Release ports
stc::release $chassisAddr/$slot1/$port1
Parameters
Parameter Data Type Description
reserve
Comments The reserve function reserves one or more ports on one or more Spirent TestCenter
chassis. When you reserve a port, your test session has exclusive access to that port for the
purpose of running a test.
To identify a port, specify a chassis-slot-port tuple.
• The chassis specification is the chassis IP address or chassis host name.
• The slot number identifies the slot.
• The port number identifies a port on a module in a chassis. Spirent TestCenter
modules are single-port or multi-port. On a single-port module, a port group consists
of one port. On a multi-port module, each port group contains two ports. A port
reservation is automatically extended to include any other ports in the group. (That is,
when you reserve a port on a multi-port module, both ports in the group are reserved.)
Note that with a multi-port module, you must explicitly reserve both ports in a group
so that Spirent TestCenter will perform the appropriate setup for each port. If you
reserve only one of the two ports in the group, the second port is locked, preventing
others from reserving it, but you must also reserve the second port explicitly in order
to use it.
To specify a chassis-slot-port tuple, use the forward-slash character (/) as a separator:
chassisIP/slot/port
You can also use a double slash prefix:
//chassis-hostname/slot/port
In a list of port groups, use a space to separate tuples:
stc::reserve c/s/p //c/s/p c/s/p
To use a port, you must also create an associated port object and specify its location when
you create or configure the object (see the description of the -location attribute for the
port object). At the end of a test, you must release every port that you reserve. Failure to
do this can put the module(s) into a state that requires rebooting. (See the description of
the release function).
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
Parameters
Parameter Data Type Description
sleep
Comments The sleep function suspends your application for the specified duration (expressed as the
number of seconds). This does not suspend the Tcl event loop; Spirent TestCenter internal
processing will continue, regardless of the state of the Tcl event loop.
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
Parameters
Parameter Type Description
subscribe
Comments Spirent TestCenter maintains a set of real-time counters through periodic updates. Use the
subscribe function to enable result collection and to write the results data to a file. The
results file uses comma-separated value format (csv).
When you call subscribe, you provide the following information:
• A handle to the Project object in your test configuration (specified as the value to the
-parent parameter).
• The object type for the results data (the -resultType parameter). The result type
determines the data to be collected. You do not create results data objects; Spirent
TestCenter creates results data objects as needed. You must establish individual
subscriptions for each result type. The results type objects are:
• The object type for the parent(s) of the result objects (the -resultParent parameter).
• The configuration object type (the -configType parameter). This object type is
defined as the source element of a ResultChild relationship that is defined for the
resultType object.
• A file name prefix for the .cvs output file. (The -filenamePrefix parameter).
Although Spirent TestCenter will collect results for a subscription, you must provide a
file name prefix to direct results output to a file. Spirent TestCenter generates one file
per result type.
• The object(s) in your test configuration that Spirent TestCenter will use to collect
results (-resultParent). A result parent identifies the set of objects for which Spirent
TestCenter will collect results. The specified result root object type is treated as a
parent, under which Spirent TestCenter collects results (-resultType) for configuration
objects (-configType).
• The rate at which Spirent TestCenter updates the subscription data and writes out
results (the -interval parameter). By default, the interval between write operations is
one second; you can specify a different value (in seconds).
• Result filtering through the use of views and view attribute lists.
The subscribe function operates in a synchronous fashion. When it returns, the test
configuration in memory has been updated with a current copy of the subscribed data.
Spirent TestCenter updates the subscription based on the value of the -interval parameter.
Approximately 2000 data elements can be subscribed before the system starts to discard
data due to throughput limitations.
Return Value The subscribe function returns a handle to a ResultDataSet object. Save this handle for
use with the unsubscribe function. You also use the ResultDataSet object to manage
paged results (see Paged Results).
Parameters
Parameter Type Description
-filenamePrefix filenamePrefix string Specifies a prefix for the .csv output file.
The -filenamePrefix parameter is optional,
but you must specify a prefix to generate
results output files.
-resultParent resultRootType-List string A result root identifies the set of objects for
which Spirent TestCenter will collect results.
A result root object type is treated as a parent,
under which Spirent TestCenter collects
results (-resultType) for configuration objects
(-configType).
If you do not specify -resultParent, Spirent
TestCenter will use the -parent Project object.
unsubscribe
Comments The unsubscribe function removes a subscription and stops the corresponding file output.
To stop a subscription, you specify the ResultDataSet handle that was returned by the
subscribe function.
Return Value None. Errors are raised as exceptions encoded as string values describing the error
condition.
Parameters
Parameter Type Description
waitUntilComplete
Syntax waitUntilComplete
Comments The waitUntilComplete function blocks your application until the sequencer has
completed its operation. Once the sequencer has finished, the function returns control to
your application.
Return Value The current state of the Command Sequencer (the value of the State attribute for the
Sequencer object).
Example stc::waitUntilComplete
Parameters None.
Chassis Management
Spirent TestCenter defines the following set of objects to represent a Spirent TestCenter
chassis and its components:
• PhysicalChassis – represents a connected chassis.
• PhysicalChassisManager – parent to the physical chassis objects.
• PhysicalChassisFan – represents a fan on the connected chassis.
• PhysicalChassisThermal – represents a thermal sensor on the connected chassis.
• PhysicalChassisSyncTopology – represents a chassis in the sync topology chain to
which the connected chassis belongs.
• PhysicalPort – represents a single port on a module.
• PhysicalPortGroup – represents a port group on a module.
• PhysicalTestModule – represents a module on a chassis.
Spirent TestCenter creates these objects automatically. The objects are organized into a
sub-hierarchy descending from the pre-defined object system1. The following figure
shows the parent-child hierarchy for the chassis-related objects.
system1
PhysicalChassisManager
PhysicalChassis
PhysicalChassisFan
PhysicalChassisThermal
PhysicalChassisSyncTopology
PhysicalTestModule
PhysicalPortGroup
PhysicalPort
In order to use any of these objects, use the get function to retrieve the object handles and
then use the object handles to retrieve attribute values for the chassis data. The following
sections describe a script that connects to a chassis and displays module information.
• Chassis Connection
• The PhysicalChassisManager Object
• Module Information
• Chassis Disconnection
Chassis Connection
To run any Spirent TestCenter Automation test, you must connect to a Spirent TestCenter
chassis. The following code fragment shows a call to the connect function.
Module Information
The code fragment on page 52 displays module, port group, and port information for a
Spirent TestCenter chassis. The code loops through the set of PhysicalChassis objects.
For each chassis object, the script:
• Retrieves the handles for the PhysicalTestModule children of the PhysicalChassis
object, then retrieves and displays the module attributes. The code uses the -children
sidename with the -PhysicalTestModule object type filter to retrieve the handles.
• For each test module object, it retrieves the handles for the PhysicalPortGroup
children of the PhysicalTestModule object, then retrieves and displays the port group
attributes. The code uses the -children sidename with the -PhysicalPortGroup
object type filter to retrieve the handles.
• For each port group object, it retrieves the handles for the PhysicalPort children of
the PhysicalPortGroup object, then retrieves and displays physical port attributes.
The code uses the -children sidename with the -PhysicalPort object type filter to
retrieve the handles.
Chassis Disconnection
At the end of your test, you should disconnect any connected chassis. The following code
fragment shows a call to the ChassisDisconnectAll command.
Initialization
Every Spirent TestCenter Automation Tcl script must load the Spirent TestCenter package
before it can use the API. The following code fragment loads the package, and it also
defines variables that will be used later in the script.
Test Configuration
The following sections contain code fragments that create objects, configure traffic, and
establish subscriptions for test results.
• Project and Port Objects
• Traffic
• Generator and Analyzer
• Subscription
###################################################################
puts " Creating project..."
set project [stc::create project]
puts " project ($project) created"
#############################
### Create the ports under the project
#############################
puts "Creating the ports..."
set port(1) [CRS stc::create port -under $project]
set port(2) [CRS stc::create port -under $project]
#############################
### Configure the ports under the project
#############################
set portReturn [CRS stc::config $port(1) -location "//$chassisAddress/$slotPort1"]
set portReturn [CRS stc::config $port(2) -location "//$chassisAddress/$slotPort2"]
#############################
### Create the port type (copper) under the port object.
#############################
set ethernetCopper(1) [CRS stc::create "EthernetCopper" \
-under $port(1) \
-Name "ethernetCopper 1" ]
Traffic
The following code fragment creates two StreamBlock objects for the transmitting port
($port(1)). This example does not configure frame headers, so Spirent TestCenter will use
the default values in the automatically created EthernetII and IPv4 header objects.
######################################
###### Create stream blocks (one per port)
######################################
puts "Creating/configuring the streamblocks on the ports..."
set StreamBlock1 [stc::create "StreamBlock" \
-under $port(1) \
-FrameLengthMode "FIXED" \
-FixedFrameLength "222" \
-LoadUnit "INTER_BURST_GAP" \
-Load "20000000.000000" \
-Priority "2" ]
#############################
### Configure the generator attributes
#############################
puts "Configuring the generator on port 1"
set generator1 [stc::get $port(1) -children-Generator]
stc::config $generator1 -Name "Generator 1"
set generatorConfig1 [stc::get $generator1 -children-GeneratorConfig]
stc::config $generatorConfig1 \
-SchedulingMode "PRIORITY_BASED" \
-DurationMode "CONTINUOUS"
#############################
### Configure the analyzer attributes
#############################
puts "Configuring the analyzer on port 2"
set analyzer2 [stc::get $port(2) -children-Analyzer]
stc::config $analyzer2 -Name "Analyzer 2"
set analyzerConfig2 [stc::get $analyzer2 -children-AnalyzerConfig]
stc::config $analyzerConfig2 \
-TimestampLatchMode "END_OF_FRAME" \
-JumboFrameThreshold "1500" \
-OversizeFrameThreshold "2000" \
-UndersizeFrameThreshold "64" \
-AdvSeqCheckerLateThreshold "1000" \
-Name "AnalyzerConfig 2"
Note that the script uses the filtered sidename syntax to retrieve the appropriate child
object handles:
stc::get $port(1) -children-Generator
stc::get $generator1 -children-GeneratorConfig
stc::get $port(2) -children-Analyzer
stc::get $analyzer2 -children-AnalyzerConfig
The sidename -children identifies the ParentChild relationship. The appended object
type name (-GeneratorConfig, for example) acts as a filter to limit the returned list to the
desired type.
Subscription
The code fragment on page 59 establishes subscriptions for both the stream block on the
transmitting port and the analyzer on the receiving port.
#############################
### Subscribing to results
#############################
puts "Subscribing to results..."
set sbResult [CRS stc::subscribe -Parent $project \
-ResultParent $port(1) \
-ConfigType StreamBlock \
-resulttype TxStreamBlockResults \
-filenameprefix streamBlock${testName}]
Notes: • The chassis-slot-port specification identifies the group to which the port
belongs. In this example, ports 1 and 2 belong to the same group. It is
necessary to explicitly reserve both ports in a group so that Spirent
TestCenter will perform the appropriate initialization for each port. For more
information about port groups, see the description of the reserve function.
• When you reserve a port, you establish exclusive access to the port.
• Port numbering begins at 1.
• The code fragment on page 61 demonstrates connection, reservation, and
mapping as three separate operations. Spirent TestCenter also provides a
single command (AttachPorts) that you can execute to perform these
operations.
#############################
# Connect to the chassis
#############################
puts "Connecting to the chassis..."
set resultReturn [CRS stc::connect $chassisAddress]
puts "Chassis connnection complete"
#############################
# Reserve ports
#############################
puts "Reserving the ports..."
set resultReturn [CRS stc::reserve "//$chassisAddress/$slotPort1"]
set resultReturn [CRS stc::reserve "//$chassisAddress/$slotPort2"]
puts "Port reservation complete"
#############################
# Setup logical <-> physical port mappings
#############################
puts "Logical to physical port mappings started..."
set resultReturn [CRS stc::perform setupPortMappings]
puts "Logical to physical port mapping complete"
#############################
### Apply the previously created configuration
#############################
puts "Applying configuration..."
set resultReturn [CRS stc::apply]
Text Execution
Once the configuration has been applied, the test can be run. The following sections show
the different aspects of test execution:
• Start traffic (Start Analyzers and Generators).
• After the time for the test has expired, Stop Traffic generation.
• Get the Frame Count.
###################################################################
puts " Starting analyzers..."
#############################
### Start analyzers
#############################
#############################
### Generate traffic
#############################
puts " Starting traffic generation..."
set generatorCurrent [stc::get $port(1) -children-generator]
stc::perform generatorStart -generatorList $generatorCurrent
puts " Traffic generation started"
###################################################################
set testTime 20
# Sleep for $testTime seconds
puts " Pausing for $testTime seconds..."
puts -nonewline " "
for {set elapsedTime 1} \
{$elapsedTime <= $testTime} \
{incr elapsedTime} \
{
stc::sleep 1
puts -nonewline "| $elapsedTime"
flush stdout
}
puts ""
puts "Pause time expired"
Stop Traffic
The following code fragment stops the generator and analyzer. Although the test was
configured for unidirectional traffic (using the generator on the first port and the analyzer
on the second port), this code stops all of the generators and analyzers. The stop operation
has no effect on any generators or analyzers that were not used.
###################################################################
# Stop traffic
puts " Stopping traffic generation..."
for {set portIndex 1} {$portIndex <= $portCount} {incr portIndex} {
set portCurrent $port($portIndex)
set generatorCurrent [stc::get $port($portIndex) -children-generator]
set analyzerCurrent [stc::get $port($portIndex) -children-analyzer]
#############################
### Validate
#############################
puts "Validating..."
puts "get individual stream block results here";
Script Termination
After the test has completed, your script should do the following:
• Release any reserved port groups. You must release all the port groups that you have
reserved. Note that a port group may contain more than one port; any attempt to use a
port handle after it has been released will result in an error. (For a description of the
release function, see the online Help for Spirent TestCenter Automation.)
• Disconnect from the chassis.
• Delete the Project object to release any resources accumulated through use of the
API.
The following code fragment shows an example of the function calls that you use to
perform cleanup.
################################################################
# Release hardware
puts "Releasing hardware..."
# Release ports
puts " Releasing ports..."
for {set portIndex 1} {$portIndex <= $portCount} {incr portIndex} {
set portCurrent $port($portIndex)
stc::release [stc::get $portCurrent -location]
}
#################################################################
# Clean up
puts "Cleaning up..."
#################################################################
IMPORTANT: You can insert commands or modify the execution order only when the
Sequencer is in the IDLE state. (For information see Sequencer / Command States.)
Sequencer Commands
The following table provides an overview of the Sequencer commands:
Sequencer States
The Sequencer operates in one of following states:
• IDLE - The Sequencer is stopped.
• INIT - The Sequencer goes through an initialization state whenever it goes from IDLE
to RUNNING.
• RUNNING - The Sequencer is executing a command.
• WAIT - The Sequencer is waiting for a command to finish executing.
• PAUSE - The Sequencer is paused
You can determine the state of the sequencer by retrieving the value of the State attribute
for the Sequencer object:
stc::get system1.sequencer -state
In the function call above, the specification system1.sequencer uses path notation to
identify the Sequencer child of the system1 object. (Spirent TestCenter creates the
system1 object automatically.) For more information about using path notation for object
and attribute references, see Referencing Objects: Object Paths.
The following figure indicates the Sequencer states, along with the commands and
conditions that promote a change in state.
IDLE
- Before SequencerStart or SequencerStep
(if starting in step mode)
- After SequencerStop
SequencerStart
SequencerStep
SequencerStop
or
INIT
- Sequencer initializing command sequence finished
RUNNING
- Sequencer executing
SequencerStart
start
command SequencerPause SequencerStep
finish
execution command or
execution breakpoint
WAIT PAUSED
- Command executing - After SequencerPause
- After stepped command execution
IMPORTANT: Once you start a command sequence (by invoking the SequencerStart
command), you should not modify your test configuration. You may use the get function
to retrieve information, but you should consider the test configuration “locked” until the
command sequence is finished or the Sequencer pauses.
Command States
Spirent TestCenter defines individual command states:
• INIT
• START
• RUNNING
• PAUSED
• PRECOMPLETE
• COMPLETED
• FAILED
• VALIDATION_ERROR
To determine the state of a command, retrieve the value of the State attribute for the
command object:
set durationState [stc::get $DurationCommand -State]
Test Configuration
The figure on page 71 shows the object hierarchy for the basic Sequencer example. The
generator, analyzer, and analyzer port result objects are shown in red, indicating that
Spirent TestCenter creates these objects automatically.
StreamBlock
Port 1 Generator
Analyzer AnalyzerPortResults
Project
This example uses two ports on a Spirent TestCenter chassis. The first port will send
traffic to the second port. During the test, the script will monitor the sequencer status.
Once the sequence is complete, the script retrieves the total frame count.
Initialization
Every Spirent TestCenter Automation Tcl script must load the Spirent TestCenter package
before it can use the API. The following code fragment loads the package, and it also
defines the location and test duration variables that will be used later in the script.
Command Sequence
The script for this example uses the following command objects, in the sequence shown:
1 AnalyzerStartCommand
2 GeneratorStartCommand
3 WaitCommand
4 GeneratorStopCommand
5 AnalyzerStopCommand
To use command objects with the Sequencer, you create command objects and insert them
into the Sequencer. The Sequencer object and the command objects are children of the
Spirent TestCenter system object (system1). Spirent TestCenter creates the system1
object automatically.
The following code fragment creates the command objects for the example configuration
and inserts them into the Sequencer.
Test Execution
The following code fragment runs the test. The test execution consists of the following
operations:
• Start the sequencer – the sequencer will execute the commands in the order in which
they were inserted into the sequencer. The time established for the WaitCommand
determines the amount of time that Spirent TestCenter will generate traffic.
• Wait until the sequence is complete. The waituntilcomplete function checks the
Sequencer state and returns control to the script when the Sequencer pauses or
becomes idle.
• Retrieve the frame count for both the transmitting and receiving ports – the script
retrieves the handle to the AnalyzerPortResult object for each port, and then uses
those handles to retrieve (and display) the total frame count.
• Disconnect from the chassis.
stc::waituntilcomplete
puts "Disconnect"
stc::perform chassisDisconnectAll
Initialization
Every Spirent TestCenter Automation Tcl script must load the Spirent TestCenter package
before it can use the API. The following code fragment loads the package, and it also
defines variables that will be used later in the script.
set scriptName "Advanced2PortSequencer.tcl"
puts "Start running $scriptName"
Test Configuration
The figure on page 76 shows the test configuration object hierarchy for the example script.
The advanced Sequencer example script uses two ports on a Spirent TestCenter chassis.
The ports use Ethernet copper connections to a DUT running at autonegotiated speeds.
EthernetCopper
ethernet:EthernetII
Port StreamBlock
ipv4:IPv4
Generator
EthIIIf
Host
Ipv4If
Project
EthernetCopper
ethernet:EthernetII
Port StreamBlock
ipv4:IPv4
Generator
EthIIIf
Host
Ipv4If
The following code fragment creates the Project, Port, and EthernetCopper objects.
• The Project object is the root of the test configuration hierarchy.
• The Port objects represent the physical ports on the Spirent TestCenter chassis.
• The EthernetCopper objects define the type of port connection, including duplex
and auto-negotiation settings.
puts " Creating project..."
set project [stc::create Project]
puts " project ($project) created"
#############################
### Create the ports under the project
#############################
puts "Creating the ports..."
set port(1) [stc::create Port \
-under $project \
-Location "//$chassisAddress/$slotPort1" \
-Name "Port //$slotPort1"]
Host objects represent host systems in the emulated network environment. Host objects
are children of the Project object; they are associated with ports on Spirent TestCenter
chassis with the AffiliationPort relation. (See Additional Relations for an example of
creating an AffiliationPort relation.) Host objects also provide the configuration of the
interface stack through the definition of interface objects. The example script uses
Ethernet and IPv4 interfaces. The interface objects (EthIIIf and Ipv4If objects) are
children of the Host objects.
The following code fragments show the creation of the Host and interface objects. (The
first code fragment creates the Host and EthIIIf objects; the second fragment creates the
Ipv4If objects.) Once these objects have been created, the stacking order of the interfaces
is determined by creating the appropriate relations (see Additional Relations).
#############################
### Create the hosts that will be used as sources for the streamblocks
#############################
set host(1) [stc::create Host \
-under $project \
-Name "Host 1"]
#############################
### Create/configure the Ethernet II interface for the hosts
#############################
set ethIIIf(1) [stc::create EthIIIf \
-under $host(1) \
-SourceMac "00:00:01:00:00:02" \
-Name "EthIIIf 1"]
The following code fragment creates the IPv4 interface objects, one for each host.
puts "Creating/configuring the host's IPv4 interface..."
set ipv4If(1) [stc::create Ipv4If \
-under $host(1) \
-Address "30.0.0.3" \
-PrefixLength "24" \
-UsePortDefaultIpv4Gateway "FALSE" \
-Gateway "30.0.0.1" \
-ResolveGatewayMac "TRUE" \
-Name "Ipv4If 1"]
Additional Relations
When you create objects (with the exception of the Project object), you specify a parent
when you call the create function (stc::create -under parent). Spirent TestCenter
automatically creates the ParentChild relations for newly created objects. A test
configuration requires additional relations between objects to establish connections that
are not available through the ParentChild relation.
The example script establishes the following relations for each port/host combination:
• The AffiliationPort relation defines the association between an emulated host and a
port on a Spirent TestCenter chassis.
• The TopLevelIf relation identifies the initial interface in the host interface stacking
order.
• The PrimaryIf relation identifies the top level interface (TopLevelIf) that faces the
DUT.
• StackedOnEndpoint relations define the stacking order of the interfaces on an
emulated host.
The following figure shows the relations that the example script creates in addition to the
automatically created ParentChild relations. In the figure, the additional relations are
shown with arrows, with the arrow pointing at the target of the relation.
Port
AffiliationPort
StackedOnEndpoint
EthIIIf
Host
Ipv4If
TopLevelIf
Project
PrimaryIf
Port
AffiliationPort
StackedOnEndpoint
EthIIIf
Host
Ipv4If
TopLevelIf
PrimaryIf
The following code fragment shows the calls to the config function to establish the
relations. Each call to config specifies the local object to be configured and a relation
specification. For example, the following call to config establishes the AffiliationPort
relation between the first host and the first port.
stc::config $host(1) -AffiliatedPort $port(1)
The relation specification uses the relation type side name (-AffiliatedPort) and the
remote object that completes the relation – $port(1). The AffiliatedPort side name
represents the remote side of the AffiliationPort relation (-targets).
puts "Setting up the relations for the hosts to the port objects..."
#############################
### Setup the relations from port level objects
### to host objects and interfaces
#############################
stc::config $host(1) -AffiliatedPort $port(1)
stc::config $host(1) -TopLevelIf $ipv4If(1)
stc::config $host(1) -PrimaryIf $ipv4If(1)
stc::config $ipv4If(1) -StackedOn $ethIIIf(1)
stc::config $host(2) -AffiliatedPort $port(2)
stc::config $host(2) -TopLevelIf $ipv4If(2)
stc::config $host(2) -PrimaryIf $ipv4If(2)
stc::config $ipv4If(2) -StackedOn $ethIIIf(2)
puts "Host relation configuration complete"
Traffic Configuration
The sequencer example generates traffic from each emulated host. The following code
fragment creates the StreamBlock, EthernetII, and IPv4 objects to define the traffic
streams.
• A StreamBlock object is a child of a Port object. The example creates one
StreamBlock object under each Port object in the configuration. The script also
clears the frame configuration. This is necessary to take advantage of the host
interface configuration (see Traffic Bindings).
• The EthernetII and IPv4 objects are children of the StreamBlock objects. Each
StreamBlock object has one EthernetII and one IPv4 child.
object. Only use the PDU library prefix for StreamBlock children, not for
any other PDU objects.
• When you specify a StreamBlock child, you must use the character case
shown (ethernet:EthernetII, for example).
Traffic Bindings
The following figure shows the source and destination bindings that are established
between the StreamBlock objects and the Ipv4If objects associated with the hosts. These
relations set the traffic streams from one port to the other.
Port StreamBlock
SrcBinding
Host
Ipv4If DstBinding
Project DstBinding
Port StreamBlock
SrcBinding
Host
Ipv4If
The following code fragment shows the function calls to establish the bindings. Each call
to config specifies the local object to be configured (the StreamBlock object) and a
relation specification for the source or destination binding. For example, the following call
to config establishes the SrcBinding relation between the StreamBlock and the Ipv4If
objects associated with the first host.
stc::config $streamBlock(1) -SrcBinding $ipv4If(1)
The relation specification uses the relation type side name (-SrcBinding) and the remote
object that completes the relation – $ipvrIf(1). The SrcBinding side name represents the
remote side of the SrcBinding relation (-targets)
#############################
### Setup the relations for the bindings in the streamblocks
### The source is the host on each port, and the destination
### is the routeblock advertised by the other port
#############################
stc::config $streamBlock(1) -SrcBinding $ipv4If(1)
stc::config $streamBlock(1) -DstBinding $ipv4If(2)
stc::config $streamBlock(2) -SrcBinding $ipv4If(2)
stc::config $streamBlock(2) -DstBinding $ipv4If(1)
Attaching Ports
To run the test, you must:
• Connect to the chassis.
• Reserve the ports that you intend to use.
• Map the reserved ports.
You can perform these operations by calling the connect function, and then use the
ReservePort and MapPort commands. As an alternative, you can accomplish all three
operations by using the AttachPorts command. The AttachPorts command uses the
location defined in the Port objects to connect to the chassis and reserve the ports, after
which it creates the mapping between the physical ports and their logical representation in
the test configuration. The following code fragment demonstrates the use of the
AttachPorts command, after which it applies the test configuration.
#############################
# Connect, reserve, and map
#############################
stc::perform attachPorts -portList "$port(1) $port(2)" -autoConnect TRUE
#############################
### Apply the previously created configuration
#############################
stc::apply
puts "Configuration applied successfully"
• Wait (WaitCommand)
• Stop the Generators (GeneratorStopCommand)
In preparation for traffic generation, the following code fragment obtains the handles to
the Generator and StreamBlock objects.
Sequenced Commands
The figure on page 86 shows the set of command objects for the advanced Sequencer test.
This figure indicates the parent-child relations for this objects. Note that command objects
are children of the internal object System1. The figure shows the System1 object in red to
indicate that Spirent TestCenter creates this object automatically.
System1
SetDurationCommand
DevicesStartAllCommand
SequencerLoopCommand (load)
IterateFrameSizeCommand
IterateLoadSizeCommand
GeneratorStartCommand
GeneratorStopCommand
The following code fragment creates the command objects. The code fragment retrieves
the handle to the Sequencer object (for inserting objects into the sequencer later – see
Execution Hierarchy), and then creates the command objects as children of the system1
object.
Execution Hierarchy
To generate traffic using varying frame sizes and loads, the command objects are
organized into execution loops that use iteration objects to determine the loop parameters.
The advanced Sequencer example uses two execution loops:
• The outer loop uses the IterateFrameSizeCommand object to step through a series
of frame sizes. The IterateFrameSizeCommand object defines:
• The method of setting the frame size (in this case STEP, increasing the frame size
with each iteration).
• The starting, step, and ending frame size values.
• The streams for traffic generation.
• The inner loop uses the IterateLoadSizeCommand object to step through a series of
load sizes. The IterateLoadSizeCommand object defines:
• The method of setting the load size (in this case STEP, increasing the load size
with each iteration).
• The load unit.
• The starting, step, and ending load size values.
• The streams for traffic generation.
The inner loop also executes the set of commands that generate traffic.
The figure on page 89 shows the execution hierarchy for the example. The actual structure
of the hierarchy is determined by insertion into the Sequencer. The figure indicates:
• The sequence of execution that is established by the order specified during insertion.
• The loop structure that is created by using the SequencerInsert command. You create
a command loop by specifying a SequencerLoopCommand object as the command
parent.
For example:
stc::perform SequencerInsert \
-CommandHandles "$iterateFrameSizeCommand $loadLoop"\
-CommandParent $frameSizeLoop
This command inserts the iterateFrameSize and load size SequencerLoop
commands into the frame size loop.
Sequencer
SetDurationCommand
DevicesStartAllCommand
IterateFrameSizeCommand
SequencerLoopCommand (load)
IterateLoadSizeCommand
GeneratorStartCommand
WaitCommand
GeneratorStopCommand
The following code fragment performs the sequencer insertion operations that set up the
execution logic, and then it runs the test.
• In this example, the insertions are handled in three separate operations that reflect the
loop structure.
• After inserting the commands into the sequencer, the script starts the sequencer and
executes a simple loop to check the sequencer state. The sequencer will transistion to
the IDLE state when the command sequence has completed.
• Once the command sequence has finished, the script releases the ports and
disconnects from the chassis.
#############################
### Setup the actual sequence of events...
#############################
stc::perform SequencerInsert \
-CommandHandles "$setDurationCommand $devicesStartAllCommand $frameSizeLoop"
stc::perform SequencerInsert \
-CommandHandles "$iterateFrameSizeCommand $loadLoop" \
-CommandParent $frameSizeLoop
stc::perform SequencerInsert \
-CommandHandles "$iterateLoadSizeCommand $generatorStartCommand \
$generatorWaitForStop $generatorStopCommand”
-CommandParent $loadLoop
Overview
Spirent TestCenter test results are collected for the duration of a test and, at the end of a
test run, Spirent TestCenter Automation writes the test results to files. To enable the
collection of test results, you must establish subscriptions for results.
The following sections provide information about:
• Log Files: The Automation Options Object
• Subscriptions
• Result Files
• Using the API to Retrieve Test Results
The call to config specifies that Spirent TestCenter will report ERROR level messages
only.
Subscriptions
To retrieve results values, you must establish subscriptions for sets of results. When you
create a subscription, you specify the following information to identify the type and scope
of results to be collected:
• The type of results to be collected (the -resultType parameter).
• The configuration object associated with the results (the -configType parameter). The
configuration object is defined as the source element of a ResultChild relationship
that is defined for the resultType object. (See the Spirent TestCenter Automation
Object Reference for the ResultChild definitions for specific result object types.)
• The root of the results collection (the -resultParent parameter). By default, the result
parent is the Project object, producing results for the entire test configuration. You
can reduce the amount of data collected by specifying a different result parent, for
example, a particular port.
Note: When you specify either the DiffServResults or the FilteredStreamResults
object type as the subscription result type (-resultType), you cannot use the default
result parent (-resultParent $project). DiffServResults and FilteredStreamResults
are associated with specific ports, so you must identify a single port as the result
parent.
For example, the following calls to the subscribe function establish subscriptions for
generatorPortResults for the transmitting port and AnalyzerPortResults for the
receiving port.
The following figure shows the objects in the test configuration that are identified by the
subscriptions above. Based on the subscription, Spirent TestCenter will create the objects
that it needs to store result values (in this example, the ResultDataSet,
GeneratorPortResults, and AnalyzerPortResults objects).
-resultParent $tx_port
Port (tx_port) Port (rx_port)
In the figure, the automatically created objects are shown in red. Note that when you call
the subscribe function, some attributes require handle values (-parent, -resultParent)
and some attributes require object type values (-configType, -resultType). The subscribe
function returns a handle to a ResultDataSet object. Spirent TestCenter uses this object to
manage the result objects. You use the ResultDataSet object to obtain handles for the
individual result objects and to managed Paged Results.
Result Files
Result files contain comma-separated values (.csv file extension). These files are suitable
for display using a spreadsheet progam, for example, Microsoft Excel, OpenOffice Calc,
or Gnumeric. You must use the subscribe function to direct Spirent TestCenter
Automation to produce result files. (You can also use Spirent TestCenter to create a results
database. For information about creating and using a results database, see End-of-Test
Results Database.)
When you call the subscribe function, you identify the type of results to be collected, and
you specify the set of objects for which the results will be collected. By default, Spirent
TestCenter Automation does not produce result output. To produce an output file you must
specify the -filenamePrefix parameter. The following example shows a subscription for
port results collected from the analyzer. The results will be written to the file
APR_results.csv in the current default directory.
set rx_resinfo [stc::subscribe -parent $project \
-resultParent $rx_port \
-configType analyzer \
-filenamePrefix “APR_results” \
-resultType analyzerPortResults]
The subscription above will generate a file containing results data for all of the attributes
defined for the AnalyzerPortResults object. To reduce the amount of data written to the
file, use the -viewAttributeList parameter to supply one or more attribute names. The
names must identify attributes defined for the -resultType object. Spirent TestCenter will
write out data for only the specified attributes. For example:
set rx_resinfo [stc::subscribe \
-parent $project \
-resultParent $rx_port \
-configType analyzer \
-filenamePrefix “APR_results” \
-resultType analyzerPortResults \
-viewAttributeList “Ipv4FrameCount TcpFrameCount UdpFrameCount” ]
modified at that point, and the result values will reflect the changes in real
time. Depending on your configuration, the type of test you are running, and
the type of modifications to the configuration, there may be a short period of
time during which your results are inconsistent.
• The subscribe function operates in a synchronous fashion. When it returns,
the test configuration in memory has been updated with a current copy of the
subscribed data. Spirent TestCenter updates the subscription based on the
value of the -interval parameter. Approximately 2000 data elements can be
subscribed before the system starts to discard data due to throughput
limitations.
The following sections provide information about accessing results data:
• The ResultsDataSet Object
• Result Report Objects (ARP/ND and Ping)
• Results From Specific Commands
The call to the get function specifies the resultChild relation; the function returns a list of
handles identifying target result objects in that relation. Then, using the handle for a result
object, the example retrieves the StreamBlock parent of the result object.
• The ping commands (PingStart and PingStop) produce results that are stored in the
PingReport object.
The following code fragment shows an example of how to use an ARP command
(ArpNdStart) and retrieve the results from the ArpNdReport object. The code fragment:
• Calls the perform function, invoking the ArpNdStart command. The command
invocation identifies the ports to be used.
• Waits five seconds for the ARP communication to complete.
• Retrieves handles to the ArpNdReport result object associated with the receiving
port. The call to the get function returns the children of the port object, and specifies
the ArpNdReport object type as a filter for the -Children relation side name
(-Children-ArpNdReport) to obtain only the ArpNdReport object.
• Displays the ARP/ND results data.
# Start ArpNd
stc::perform ArpNdStart -HandleList [list $hPortRx $hPortTx]
# Display ArpNdReport.
set hArpNdReport [stc::get $hPortRx -Children-ArpNdReport]
puts "\nArpNdReport information"
foreach {szAttr szName} [stc::get $hArpNdReport] {
puts \t$szAttr\t$szName
}
There are a limited set of commands that produce results directly upon execution. These
commands can be divided into the following categories:
• ARP/ND
• DHCP
• PPPox
• L2tp
The following table shows the categories, the associated commands, and the
corresponding result objects that are updated.
Dhcpv6SessionInfo DhcpIpv6SessionResults
PppoxSessionInfo PppoL2tpv2SessionResults
L2tpNodeInfo L2tpv2NodeResults
L2tpTunnelInfo L2tpv2TunnelResults
For example, to retrieve the ARP cache table for a set of ports, use the
ArpNdUpdateArpCache command. The following code fragment:
• Calls the perform function, invoking the ArpNdUpdateArpCache command. The
command invocation identifies the ports for which cache table data is desired.
• Retrieves handles to the ArpCache result objects associated with the ports. The call
to the get function returns the children of the port object, and specifies the ArpCache
object type as a filter for the -Children relation side name (-Children-ArpCache) to
obtain only the ArpCache object.
• Displays the ARP cache table data.
Paged Results
For certain result types, Spirent TestCenter Automation provides a mechanism to divide
large amounts of results data into “pages”. You can use this mechanism to retrieve the
results one page at a time.
When you create a subscription, the subscribe function returns a handle to a
ResultsDataSet object. Use the ResultsDataSet object to manage paged results. You can
use the paged results support for the following results object types (specified with the
resultType parameter in the call to the subscribe function).
AnalyzerPortResults TxPortPairResults
DiffServResults RxPortPairResults
FilteredStreamResults TxStreamBlockResults
GeneratorPortResults RxStreamBlockResults
PortAvgLatencyResults TxStreamSummaryResults
TxCpuPortResults RxStreamSummaryResults
RxCpuPortResults TxTrafficGroupResults
RxTrafficGroupResults
To define the amount of data in a page, and to identify the data to be retrieved, use the
following attributes (defined for the ResultsDataSet object).
• The RecordsPerPage attribute defines the amount of data in a page. A record
corresponds to the data associated with one result object.
• The PageNumber attribute identifies the data to be retrieved. To retrieve all of the
data produced by a subscription, set the PageNumber attribute to one, and increment
the value until it reaches the TotalPageCount value.
• The TotalPageCount attribute defines the total number of pages. (This is a read-only
attribute determined by the RecordsPerPage value.)
The following sections describe an example script that uses the paged result mechanism.
• Initialization
• Test Configuration
• Subscription
• Traffic Generation
• Retrieving Results
• Cleanup
Initialization
Every Spirent TestCenter Automation Tcl script must load the Spirent TestCenter package
before it can use the API. The following code fragment loads the package, and it also
defines variables that will be used later in the script.
# Equipment variables
set chassisAddr 10.100.20.5
set portCount 2
set txSlot
set txPort
set rxSlot
set rxPort 2
# Emulation Variables
set txIpAddr "10.1.1.1"
set rxIpAddr "20.200.2.2"
Test Configuration
The example uses two ports on a single Spirent TestCenter chassis – one port for
transmitting traffic, one port for receiving traffic. This test generates Ethernet traffic with
a range of addresses.
The script creates the following objects:
• The Project object is the root of the test configuration object hierarchy.
• The Port objects represent physical ports on the Spirent TestCenter chassis. Port
objects are children of the Project object.
• The StreamBlock object defines the traffic for the test. The StreamBlock object is a
child of the first Port object.
• The EthernetII object defines the source and destination MAC addresses.
• The RangeModifier object specifies a range of addresses for the traffic stream.
The following figure shows the test configuration object hierarchy. In the figure, the
objects that Spirent TestCenter creates automatically are shown in red. The script uses the
Generator objects on the transmitting port, and the Analyzer objects on the receiving port.
Spirent TestCenter creates result objects based on the subscriptions.
EthernetII
StreamBlock RangeModifier
RxStreamSummaryResults
Port (Tx)
Generator GeneratorConfig
AnalyzerConfig
Project
Port (Rx) Analyzer
AnalyzerPortResults
The figure shows three object types associated with results data:
• ResultDataSet – This example uses two subscriptions, and thus, two ResultDataSet
objects. Of the two subscriptions, only the ResultsDataSet object for the
RxSTreamSummaryResult subscription can be used for paged retrieval.
• RxStreamSummaryResults – For this subscription, Spirent TestCenter collects
stream summary results for the receiving port; the script will use the paged result
mechanism for these results.
• AnalyzerPortResults – Using this subscription, the script will retrieve frame length
and count data.
The following sections describe different elements of the test configuration for the
example script:
• Project and Port Objects
• Traffic Configuration
• Generator/Analyzer Configuration
The following code fragment creates the Project and Port objects for the test. After the
script creates the Port objects, it executes the attachPorts command to connect to the
chassis, then reserve and map the ports. Once the ports are attached, the script applies the
configuration. This code fragment also shows a Tcl catch statement, which begins a block
that encloses the rest of the script.
# Configuration begins
if {[catch {
# Create the root project object
set proj [stc::create project]
# Create ports
puts "Create ports"
set txPortHandle [stc::create port -under $proj \
-location //$chassisAddr/$txSlot/$txPort \
-useDefaultHost False ]
set rxPortHandle [stc::create port -under $proj \
-location //$chassisAddr/$rxSlot/$rxPort \
-useDefaultHost False ]
Traffic Configuration
In preparation for generating traffic, the script stops the generator and analyzer, so that the
test will begin in a known, initialized state.
The paged results script uses the following objects to configure traffic:
• The StreamBlock object defines the general parameters for test traffic. The
StreamBlock object is a child of the first Port object (the transmitting port).
• The EthernetII object provides the source and destination MAC addresses.
• The script uses a RangeModifier object to generate a range of destination addresses
in the traffic stream.
Generator/Analyzer Configuration
#
# Configure generator
#
puts "Configuring Generator"
set generatorConfig [stc::get $generator -children-GeneratorConfig]
stc::config $generatorConfig \
-DurationMode BURSTS \
-BurstSize 1 \
-Duration 32767 \
-LoadMode FIXED \
-FixedLoad 100 \
-LoadUnit PERCENT_LINE_RATE \
-SchedulingMode RATE_BASED
#
# Analyzer Configuration
#
puts "Configuring Analyzer"
set analyzerConfig [stc::get $analyzer -children-AnalyzerConfig]
Subscription
The paged result example establishes two subscriptions:
• AnalyzerPortResults (non-paged) – The script will use this subscription to obtain
frame length and frame count data.
• RxStreamSummaryResults (paged) – The script will use the ResultDataSet object
associated with the stream summary results subscription to manage the paged result
retrieval. This subscription also specifies output to a file.
The following code fragment establishes the subscriptions and applies the configuration.
#
# Subscribe to analyzer results
#
puts "Subscribe to results"
stc::subscribe -parent [stc::get system1 -children-Project] \
-resultParent [stc::get system1 -children-Project] \
-configType analyzer \
-resultType AnalyzerPortResults -interval 1
set rdsRxStreamSum \
[ stc::subscribe -parent [lindex [stc::get system1 -children-Project] 0] \
-resultParent [stc::get system1 -children-Project] \
-configType streamblock \
-resultType rxstreamsummaryresults \
-interval 1 \
-filenamePrefix "rxstreamsummaryresults-5228" ]
Traffic Generation
To generate traffic, the script:
• Starts the Analyzer on the receiving port.
• Waits for two seconds.
• Starts the Generator on the transmitting port.
• Waits for five seconds.
• Stops the Analyzer.
Retrieving Results
In the code fragment on page 107, the script first retrieves results based on the
AnalyzerPortResults subscription. The script:
• Retrieves the handle to the AnalyzerPortResults object.
• Retrieves frame length and counts defined for the AnalyzerPortResults object
(JumboFrameCount, SigFrameCount, UndersizeFrameCount, OversizeFrameCount,
MaxFrameLength, TotalFrameCount).
After retrieving the frame data, the script uses the paged mechanism to retrieve data from
the RxStreamSummaryResults subscription. The script uses the default page size (100
records per page). The script:
• Retrieves the total page count
• Loops through the paged data:
• Sets the page number in the ResultsDataSet object (the subscribe function
returns the handle to the ResultsDataSet object).
• Applies the updated configuration.
• Retrieves the results for the page.
• Loops through the records for the retrieved page and display sthe results for each
record (object).
• Increments the page number.
• Retrieves the total page count (the total may have changed if results collection
was not complete when loop started).
set pageNumber 1
puts "[stc::get $rdsRxStreamSum -totalPageCount]"
set totalPageCount [stc::get $rdsRxStreamSum -totalPageCount]
while { $pageNumber < $totalPageCount } {
puts "Set page $pageNumber: [time [ stc::config $rdsRxStreamSum \
-pageNumber $pageNumber ] 1 ]"
puts "Update results: [time [ array set res [ stc::apply ] ] 1 ]"
incr pageNumber
set totalPageCount [stc::get $rdsRxStreamSum -totalPageCount]
}
Cleanup
After stopping the generators and analyzers, the script:
• Releases the reserved ports. The script uses the detachPorts command to release the
ports.
• Disconnects from the chassis.
• Deletes the Project object to delete the test configuration.
The following code fragment shows an example of the function calls that you use to
perform termination.
### Release/Disconnect
puts "Releasing $chassisAddr/$txSlot/$txPort and $chassisAddr/$rxSlot/$rxPort"
stc::release "$chassisAddr/$txSlot/$txPort $chassisAddr/$rxSlot/$rxPort"
To create a results database, use the SaveResult command. The following example shows
a call to SaveResult. The command creates a database named “analyzer_filters.db” that
contains results for the entire test configuration.
You can use the EotResultsWriteIteration command to write results for the current
configuration at the end of a test iteration. For example, you can include a call to this
function at the end of a sequencer loop. The following code fragment creates an
EOTResultsWriteIterationCommand object to write out the results associated with the
specified stream block list.
== (equals)
!= (does not equal)
> (greater than)
>= (greater than or equal to)
< (less than)
<= (less than or equal to)
For example, the filter expression "TotalTxFrameCount > 50" returns the
TotalTxFrameCount values that are greater than 50. By default, QueryResult
returns all values.
The following example shows a call to the perform function to execute the QueryResult
command.
stc::perform QueryResult \
-databaseConnectionString "analyzer_filters.db" \
-attributeList "PortName TotalTxFrameCount TotalRxFrameCount" \
-resultType "SavedResult/PortTraffic/BasicTrafficCounters/BasicCounters"
Results Reporter
The Results Reporter is a tool with a Graphical User Interface (GUI) and a limited
command line interface. You can use the Results Reporter to do the following:
• View the Contents of a Results Database
• Using the Results Reporter to View a Test Configuration
• Using the Results Reporter to Produce Reports
• If you are running Spirent TestCenter on a Unix system (Linux or Solaris), you can
invoke the Results Reporter from a script.
The actual path to the Results Reporter depends on where you have installed Spirent
TestCenter; the actual path to the database is the location that you used when you saved
the configuration results. Spirent Communications provides the shell file
STCResultsReporter.sh to run the Results Reporter.
To use the Results Reporter to view a test configuration, you must run Spirent TestCenter
as a server.
• Add the following lines to the file stcbll.ini:
[msg]
serverPort=5009
serverAddress=localhost:5009
• Use a second Tcl script to connect to the server and display the configuration in the
Results Reporter: (The following example is based on a Linux installation.)
The Results Reporter defines a limited command line interface that you can use to produce
reports using data from the result database. To use the command line interface, execute
one of the following files:
• On Windows:
ResultsReporterCLI.bat
• On Unix:
ResultsReporterCLI.sh
For example (on Unix):
./ResultsReporterCLI.sh -o MyResults.db -f pdf -d MyResults.pdf -t
templates/CustomStats.rtp
This example generates PDF from your database file "MyResults.db", creating the file
MyResults.pdf using the template CustomStats.rtp. Templates are located in the following
directory:
Spirent TestCenter Application\Templates\System\Result Views
Option Description
PGA Protocols
Ethernet Protocol The Ethernet Protocol is a data link protocol for local area networks (LANs). Ethernet
communication is based on Media Access Control (MAC) addresses. An Ethernet frame
uses the MAC addresses encoded in the network adapter cards for devices attached to the
Ethernet network segment. In the Spirent TestCenter environment, you use Spirent
TestCenter software running on a Spirent TestCenter chassis to simulate large Ethernet-
based networks.
Internet Protocol The Internet Protocol supports the transmission of internet datagrams from a source to a
(IP) destination. IP supports two basic functions: addressing and fragmentation.
• Addressing: IP uses fixed-length addresses to identify both source and destination
hosts. IPv4 uses 32-bit addresses, generally represented in dotted decimal notation
(for example, 10.10.100.1). IPv6 use 128-bit addresses, normally written as eight
groups of up to four hexadecimal digits, separated by colons (for example,
1001:0ac8:11a1:02e1:2244:3a2e:8260:6443).
• Fragmentation: IP specifies a method for dividing large packets into smaller packets
at any point on a route between the source and destination. When transmitted data is
fragmented, the IP header fields provide the information that is required for the
destination host to reassemble the original transmission.
IP is limited in scope; it does not provide any transport services. IP is used with either the
Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP) as a transport
protocol.
User Datagram UDP provides port-based, connectionless transmission of data. Unlike the TCP, UDP adds
Protocol (UDP) no reliability or flow-control functions to IP. Because of UDP's simplicity, UDP headers
contain fewer bytes and consume less network overhead than TCP.
Initialization
Every Spirent TestCenter Automation Tcl script must load the Spirent TestCenter package
before it can use the API. The following code fragment:
• Loads the Spirent TestCenter package.
• Displays the Spirent TestCenter version number. The script uses the pre-defined name
“system1” to obtain the version information.
• Creates variables for chassis, slot, and port values. The script will use these variables
to set the port location.
Note that the entire script is contained within a Tcl catch block.
if {[catch {
package require SpirentTestCenter
# Physical topology
set szChassisIp 10.100.33.30
set iTxSlot 11
set iTxPort 9
set iRxSlot 11
set iRxPort 10
Object Hierarchy
The following figure shows the test configuration object hierarchy for the example script.
The example script uses two ports on a Spirent TestCenter chassis. The ports use Ethernet
copper connections to a DUT running at autonegotiated speeds.
The generator and analyzer objects (along with the corresponding configuration and result
objects) are shown in red, indicating that Spirent TestCenter creates these objects
automatically.
EthernetCopper
ethernet:EthernetII
StreamBlock
Port ipv4:IPv4
(transmitting)
GeneratorConfig
Generator
Project GeneratorPortResults
EthernetCopper
Port
(receiving)
Analyzer AnalyzerPortResults
• The Port objects represent physical ports on the Spirent TestCenter chassis.
• The EthernetCopper objects define the type of port connection, including duplex,
line speed, and auto-negotiation settings.
• The StreamBlock, ethernet:EthernetII, and ipv4:IPv4 objects define the traffic
stream for the test. The StreamBlock is a child of a Port object; in this example, the
stream that it defines applies to the transmitting port. A StreamBlock can also be a
child of the Project object, in which case it defines streams for all ports.
The ethernet:EthernetII and ipv4:IPv4 objects are Protocol Data Unit (PDU)
objects. The PDU objects represent protocol headers for packets.
• The Generator object (shown in red to indicate that Spirent TestCenter creates this
object automatically) represents the traffic generator for the transmitting port.
• The GeneratorConfig object (shown in red to indicate that Spirent TestCenter creates
this object automatically) defines the parameters for traffic generation on the
transmitting port.
• The GeneratorPortResults object (shown in red to indicate that Spirent TestCenter
creates this object automatically) contains generator result data for the transmitting
port.
• The Analyzer object (shown in red to indicate that Spirent TestCenter creates this
object automatically) represents the Analyzer for the receiving port.
• The AnalyzerPortResults object (shown in red to indicate that Spirent TestCenter
creates this object automatically) contains analyzer result data for the receiving port.
The following code fragment creates the Project, Port, and EthernetCopper objects.
After the script creates the port configuration, it invokes the AttachPorts command.
AttachPorts accomplishes the following actions:
• Connect to the chassis (using the chassis IP address specified in the Port object
location attribute).
• Reserve the ports.
• Create the mapping between the physical ports on the chassis and their logical
representations in the test configuration.
You can perform these operations separately, by calling the connect function, and then
using the ReservePort and MapPort commands; however, the AttachPorts command is
more efficient.
# Create ports
puts "Creating ports ..."
set hTxPort [stc::create port -under $hProject \
-location //$szChassisIp/$iTxSlot/$iTxPort \
-useDefaultHost False ]
set hRxPort [stc::create port -under $hProject \
-location //$szChassisIp/$iRxSlot/$iRxPort \
-useDefaultHost False ]
Traffic Configuration
This example generates traffic from a single port. The following code fragment creates the
StreamBlock, EthernetII, and IPv4 objects to define the traffic stream.
• The script creates a StreamBlock object as a child of the transmitting Port object.
The script also clears the frame configuration because the script will create the PDU
objects explicitly.
• The EthernetII and IPv4 PDU objects are children of the StreamBlock objects.
Spirent TestCenter constructs packets using headers that correspond to the PDU
objects; the order of headers in the packets is the order in which the PDU objects were
created.
ethernet:EthernetII
ipv4:IPv4
When you use Protocol Data Unit (PDU) objects that are children of
StreamBlock objects, you must use the PDU library name prefix for the
object. Only use the PDU library prefix for StreamBlock children, not for
any other PDU objects. The Spirent TestCenter Automation Object Reference
shows the PDU library prefix for the PDU objects.
• When you specify a StreamBlock child, you must use the character case
shown (ethernet:EthernetII, for example).
Generator Configuration
Traffic generators are associated with ports; Spirent TestCenter creates Generator objects
automatically, as children of Port objects. To manage traffic generation, Spirent
TestCenter also creates GeneratorConfig and GeneratorPortResults objects as children
of Generator objects.
# Configure generator.
puts "Configuring Generator on transmitting port"
set hTxGeneratorConfig [stc::get $hTxGenerator -children-GeneratorConfig]
Note that you can set traffic parameters at both the port (GeneratorConfig) and stream
(StreamBlock) levels. The GeneratorConfig object SchedulingMode attribute setting
determines how Spirent TestCenter will use the traffic parameters.
• The scheduling mode PORT_BASED directs Spirent TestCenter to use port
parameters to generate traffic.
• The scheduling mode RATE_BASED directs Spirent TestCenter to use stream
parameters to generate traffic.
• The scheduling mode PRIORITY_BASED directs Spirent TestCenter to generate
traffic according to the setting of the StreamBlock object Priority attribute.
Set the scheduling mode before you configure the port or stream parameters.
Subscription
The following calls to the subscribe function establish subscriptions for
generatorPortResults and AnalyzerPortResults. For detailed information, see the
description of the subscribe function and the information about creating Subscriptions.
# Apply configuration.
puts "Applying configuration"
stc::apply
Traffic Generation
The following code fragment starts the Analyzer and generates traffic for the test. The
generator is configured to transmit for a fixed period of time, so the script uses the
GeneratorWaitForStop command to suspend script execution before continuing. The
script also uses a Tcl “after” statement to suspend execution to allow the Analyzer time to
complete its tasks.
Retrieving Results
The script uses the GeneratorPortResults and AnalyzerPortResults objects to obtain
transmitted and received frame counts. The following code fragment:
Test Completion
At the end of the test, the script releases the ports and disconnects from the chassis.
# Detach ports.
stc::perform detachPorts -portList [list $hTxPort $hRxPort]
# Delete configuration
puts "Deleting project"
stc::delete $hProject
} err] } {
puts "Error caught: $err"
}
Packet Generation
When you create a test configuration for traffic generation, you create one or more
StreamBlock objects, each with one or more PDU objects. When your test starts
generating traffic, Spirent TestCenter transmits packets containing protocol headers based
on the definitions of the PDU objects.
The following sections describe different aspects of packet generation:
• Starting Traffic Generators
• Packet Generation – Single Stream
• Packet Generation – Multiple Streams and Modifiers
• Using Multiple Modifiers
• Custom Headers
In the traffic configuration represented above, the Ethernet header defines a single source
MAC address and a single destination MAC address. For that traffic stream, all of the
packets are sent to the same destination (and are identified as coming from a single
source).
Modifier Objects
EthernetII
-Name eth_hdr1
-dstMac
[...]
Project Port StreamBlock
RangeModifier
-OffsetReference eth_hdr1.dstMac
[...]
This RangeModifier object references the destination MAC field of the Ethernet header.
The -OffsetReference value (eth_hdr1.dstMac) uses the following dotted notation format:
PDU-object-name.attribute-name
The PDU-object-name portion of the reference is the value of the -Name attribute for the
PDU object. The attribute-name is the name of one of the attributes defined for the object.
The two names are separated by a dot.
Modifier objects also specify the parameters that Spirent TestCenter applies to the field
value when it generates packets. The parameters determine the set of values that will be
generated according to the type of modifier.
• The RangeModifier object defines a range of values that Spirent TestCenter uses to
modify a header field. When you use a RangeModifier, you specify a starting value,
a mask to indicate which bytes of the field are to be modified, a step value, and a limit
to the range. Range modifiers also use modifier modes to determine how the
generated values are applied (increment, decrement, or shuffle).
• The RandomModifier object uses a random set of values to modify a header field.
When you use a RandomModifer object, you specify a mask to indicate which bytes
of the the field are to be modified. Spirent TestCenter produces random field values
for the duration of traffic generation.
• The TableModifier object uses a fixed set of values to modify a header field. When
you use a TableModifier object, you specify a list of values that Spirent TestCenter
uses for the header field.
The following table provides an overview of the RangeModifier object used in the
Modifier Example. For more detail and information about the RandomModifier and
TableModifier objects, see the Spirent TestCenter Automation Object Reference.
RangeModifier Description
Attributes
-DataType The data type for the -Data, -StepValue, and -Mask attribute values.
Spirent TestCenter defines two types: NATIVE and BYTE.
NATIVE modifier values are expressed in formats to match the type
of the header field to be modified. For example, in NATIVE mode, the
-Data, -StepValue, and -Mask values that modify an IPv4 header
address must be specified in IPv4 address format (such as -StepValue
0.0.0.1). Spirent TestCenter validates the formate of NATIVE mode
values.
BYTE modifier values are expressed as hexidecimal values. BYTE
values do not require any delimiters. Spirent TestCenter does not
validate the format of BYTE mode values.
-Data The initial value for the field. Must be specified using a format that
corresponds to the data type (NATIVE or BYTE).
-StepValue The step value used for incrementing or decrementing the header field
value through the range. Must be specified using a format that
corresponds to the data type (NATIVE or BYTE).
-Mask A mask indicating the bytes that will be affected. Must be specified
using a format that corresponds to the data type. The mask feature
only works with the RangeModifier when the -EnableStream
attribute is set to TRUE. The size of the mask value must match the
field to be modified, taking into account any size limitation imposed
by an offset location within the field (-Offset), if specified.
-RecycleCount The number of times the field value will change before starting again.
-Offset An offset value indicating a byte position within the field. (only used
with -DataType BYTE.) If you specify an offset, adjust the size of the
-Data and -Mask values accordingly so that they do not extend
beyond the header field.
RangeModifier Description
Attributes
Modifier Example
The following figure shows the objects for a stream block with an Ethernet header and a
RangeModifier object that references the destination MAC address in the EthernetII
PDU object. The figure also shows the code fragment that creates these objects.
• The modifier specifies a range of 20 MAC addresses (-RecycleCount), starting with
the address 00:00:00:00:00:00 (-Data). The mask value indicates that the four least
significant bytes can change (-Mask 00:00:FF:FF:FF:FF).
• When Spirent TestCenter applies the modifier, it will use an increment of 1
(-ModifierMode, -StepValue) to increment the destination MAC address 20 times
before starting again with the intial value.
• The modifier is configured to use native mode (-DataType), so the -Data, -Mask, and
-StepValue values are specified in the format that the header field uses (in this
example, MAC address format).
• This example uses signature fields (StreamBlock attribute -InsertSig set to TRUE).
It also uses software stream generation (RangeModifier attribute -EnableStream set
to TRUE), so that Spirent TestCenter will generate a unique signature field value for
each stream generated from this stream block.
EthernetII
-Name eth_hdr1
-dstMac
Project Port StreamBlock
RangeModifier
-OffsetReference eth_hdr1.dstMac
the next modifier in the chain. To chain modifiers together, set the CarryChainTo
relation.
• You can stack modifiers. To stack modifiers, create multiple modifiers that reference
the same PDU field. For stacked modifiers, you must also specify -Mask values such
that the modifiers do not manipulate the same bits of the referenced field. (The -Mask
values cannot overlap.)
The following figure shows the objects and corresponding code fragment for a stream
block with Ethernet and IPv4 headers. There are three range modifiers to manipulate the
headers. After creating the objects, the modifiers are chained together. Spirent TestCenter
will use the modifiers in the chained sequence:
• Modifier 1 – Spirent TestCenter generates five packets, changing the destination
MAC address in the Ethernet header in each packet.
• Modifier 2 – Spirent TestCenter generates five packets, changing the destination
MAC address in the Ethernet header in each packet.
• Modifier 3 – Spirent TestCenter generates five packets, changing the protocol
specification in the IPv4 header in each packet.
EthernetII
-Name sb1_ethI
-srcMac
-dstMac
Ipv4
-Name sb1_ip
-protocol
RangeModifier
-OffsetReference sb1_ethI.srcMac
RangeModifier
-OffsetReference sb1_ip.protocol
Custom Headers
Spirent TestCenter Automation provides the Custom header object that you can use to
modify the contents of a packet payload. The Custom object has a single attribute
(-Pattern) which you use to specify a sequence of bytes in hexadecimal format. Spirent
TestCenter will insert the byte pattern into the packet at the location that corresponds to
the order of your PDU object creation sequence. Once you have created the Custom
object, you can create a modifer object that uses the Custom object -Name attribute value
and -Pattern reference (-OffsetReference custom-pdu-name.pattern) to identify the
payload for modification.
Test Analysis
Spirent TestCenter supports the following test analysis methods:
• Tracking Packets By Signature Field
• Analyzer Filters
• Histograms
• Capture
# create a modifier
set rangemod [stc::create RangeModifier -under $hStreamBlockTx \
-enablestream TRUE \
-offsetreference ipv4hdr.destAddr \
-data 0.0.0.0 \
-stepvalue 0.0.0.1 \
-mask 0.0.0.255 \
-recyclecount 100]
When a test runs using this configuration, the results show counts for 100 separate streams
(-RecycleCount 100). If the configuration is changed to use hardware-based streams
(-EnableStream FALSE), all packets generated using that stream block will have the
same signature. The results will show the counts grouped together as if they are a single
stream, regardless of destination addresses or any other potentially differentiating field. To
track specific field values, use an Analyzer filter (see the following section).
Analyzer Filters
You can use the Analyzer to track specific field values in incoming signature-tagged
packets. There are two methods you can use to specify Analyzer filters:
• AnalyzerFrameConfigFilter and PDU Objects
• Bit Filter Objects
PDU
Project Port Analyzer AnalyzerFrameConfigFilter Objects
To use a PDU object for an Analyzer filter, set the header field to be filtered by using a
filter specification for the corresponding PDU object attribute value. The following code
fragment shows how to use PDU objects to set up filters for MAC and IP addresses. The
code fragment:
• Retrieves the handle to the Analyzer object.
• Creates an AnalyzerFrameConfigFilter object. The script also clears the frame
configuration because the script will define the filter by creating the PDU objects
explicitly.
• Creates an EthernetII PDU object with a filter specification for the source MAC
address: -srcMac 00:00:00:00:00:00/FF:FF:FF:FF:FF:FF#FF:FF:FF:FF:FF:FF
• Creates an Ipv4 PDU object with a filter specification for the destination IPv4
address: -destAddr 192.168.1.1/192.168.1.3#255.255.255.255
stc::create ethernet:EthernetII \
-under $hAnalyzerFrameConfigFilter \
-name af1_eth \
-srcMac "00:00:00:00:00:00/FF:FF:FF:FF:FF:FF#FF:FF:FF:FF:FF:FF"
Specify the values in NATIVE format to match the field being filtered. The minimum and
maximum values are separated by a forward slash (/); the maximum and mask values are
separated by a number sign (#).
Spirent TestCenter provides 16– and 32–bit filter objects that you can apply to traffic
streams. To use a bit filter object, create the object (Analyzer16BitFilter or
Analyzer32BitFilter) as a child of the Analyzer or AnalyzerFrameConfigFilter object.
The following figure shows the bit filter objects.
Analyzer16BitFilter
AnalyzerFrameConfigFilter
Analyzer32BitFilter
Project Port Analyzer
Analyzer16BitFilter
Analyzer32BitFilter
Histograms
Spirent TestCenter provides a histogram engine that compiles results based on stream
analysis. To use the histogram engine with Spirent TestCenter Automation, you must
configure the Analyzer to perform histogram calculations. When you use the histogram
engine, Spirent TestCenter tracks frames that contain a signature field. The StreamBlock
object attribute insertSig controls the insertion of a signature field into frames. (By
default, insertSig is set to TRUE.)
The following sections provide information about using Spirent TestCenter Automation to
perform histogram calculations on your test data.
• Histogram Calculations
• Histogram Configuration Objects
• Configuring the Histogram Engine
Histogram Calculations
FrameLengthHistogram
InterarrivalTimeHistogram
JitterHistogram
Project Port Analyzer AnalyzerConfig
LatencyHistogram
SeqDiffCheckHistogram
SeqRunLengthHistogram
To use a particular type of histogram calculation, retrieve the handle to the appropriate
histogram object and set the attributes. Histogram objects have the following attributes:
• BucketSizeList - Specifies a list of bucket size values; used when DistributionMode is
CUSTOM_MODE and ConfigMode is CONFIG_SIZE_MODE.
• ConfigMode - Bucket configuration mode; CONFIG_SIZE_MODE uses bucket
sizes, CONFIG_LIMIT_MODE uses bucket limits (-LimitList).
• DistributionMode - One of CENTERED_MODE, LEFT_MODE, RIGHT_MODE, or
CUSTOM_MODE.
• DistributionModeSize - Bucket size relative to non-custom distribution modes.
• LimitList - List of bucket limits when -ConfigMode is CONFIG_LIMIT_MODE.
• UniformDistributionSize - Size of the uniformly sized buckets.
See the Spirent TestCenter Automation Object Reference for details about the histogram
objects.
The following code fragment demonstrates how to configure the histogram engine for
frame length calculations, using limits for bucket configuration.
Capture
You can direct Spirent TestCenter Automation to capture frame data during a test. To
capture data, your script must perform the following steps:
1 Create the test configuration.
2 Set the capture parameters. This will involve setting attributes for one or more
automatically created objects, and possibly creating additional objects to specify
detailed capture filtering. (This step is optional. You can use the default parameters to
capture all traffic, transmitted and received.)
3 Start capture.
4 Start and then stop traffic.
5 Stop capture and save the captured data.
The following sections provide information about using the capture capability.
Spirent TestCenter defines a set of capture objects that you use to define and control
capture. The capture capability is associated with ports. The following figure shows the
capture objects. The objects shown in red indicate the objects that Spirent TestCenter
creates automatically.
CaptureFilter CaptureAnalyzerFilter
CaptureFilterStartEvent
Project Port Capture
CaptureFilterStopEvent
CaptureFilterStopE
PacketFrame
When you create a Port object, Spirent TestCenter automatically creates the following
objects:
• The Capture object manages capture operations for the port, handling settings for the
different capture modes.
• The CaptureFilter object supports pre-define capture filters that operate at the
protocol header level, and filters that use various size constraints. To filter packets at a
finer level of granularity, use the CaptureAnalyzerFilter object (see Capture
Triggers).
• The CaptureFilterStartEvent object defines events that will start capture.
• The CaptureFilterStopEvent object defines events that will stop capture.
See the Spirent TestCenter Automation Object Reference for more information about these
objects.
Starting Capture
To start capture:
• Retrieve the handle to the Capture object. Capture objects are automatically created
children of Port objects.
• Set the capture parameters. This example uses REGULAR_MODE to capture all
packets, and TX_RX_MODE to capture both transmitted and received packets.
• Invoke the CaptureStart command, specifying the handle to the Capture object as
the -CaptureProxyId attribute value.
set hCapture [stc::get $hPortRx -children-capture]
stc::config $hCapture -mode REGULAR_MODE -srcMode TX_RX_MODE
stc::perform CaptureStart -captureProxyId $hCapture
Stopping Capture
After stopping traffic, and then stopping the generator(s) and analyzer(s), invoke the
CaptureStop command and save the capture data to a file. The CaptureDataSave
command creates a PCAP file containing raw packet data.
stc::perform CaptureStop -captureProxyId $hCapture
stc::perform CaptureDataSave -captureProxyId $hCapture \
-FileName "capture.pcap"
You can use tools such as Ethereal or Wireshark to view the contents of PCAP files.
Capture Loopback
To determine what is being transmitted from a port, you can set up a local loopback in
software and then capture the received frames. To set up a configuration for a local
loopback, use the following objects that are children of the Port object associated with the
transmitting port.
• Create an EthernetCopper object and set the -DataPathMode attribute to
LOCAL_LOOPBACK. (You can also use an EthernetFiber object for this purpose.)
• Retrieve the Capture object (automatically created as a child of the Port object) and
set the -SrcMode attribute to RX_MODE).
This configuration uses a software loopback; the effect is that the port transmits and then
receives the transmitted packets. The RX_MODE setting for the Capture object allows
Spirent TestCenter to track the packets in loopback. The following figure shows the object
hierarchy for local loopback and a representation of the software loopback connection that
is created for the port. (The Capture object is shown in red to indicate that it is
automatically created.)
EthernetCopper
-DataPathMode LOCAL_LOOPBACK
Project Port
Capture
-SrcMode RX_MODE
Spirent
TestCenter
Chassis
Port
virtual loopback
Capture Triggers
NOTE: Spirent TestCenter provides two independent filtering mechanisms – the Capture
filter and the Analyzer filter. The Capture filter does not apply when analyzing streams,
and the Analyzer filter does not apply when capturing packets.
PPPoE Overview
The Point-to-Point Protocol (PPP) provides a method of transporting datagrams over
point-to-point links between hosts, switches, and routers. Spirent TestCenter provides
support for Point-to-Point Protocol over Ethernet (PPPoE). In PPPoE communication, a
PPPoE frame is embedded within an Ethernet Frame. The Ethernet frame headers include
an ETHER_TYPE field, which identifies the PPPoE stage (discovery or session). The
Ethernet frame payload contains headers that include a CODE field, which identifies the
PPPoE content (contained in the PPPoE frame payload). For a detailed description of
PPPoE encapsulation, see RFC 2516 - A Method for Transmitting PPP Over Ethernet
(PPPoE).
To support PPP-encapsulated data transmission over Ethernet:
• PPPoE defines a discovery stage.
• PPPoE uses the PPP session stage which consists of the following:
• A Link Control Protocol (LCP) for configuring the data-link connection.
• Network Control Protocols (NCPs) for configuring different network-layer
protocols.
PPPoE Discovery
PPPoE Discovery uses a client-server model. PPPoE clients broadcast initiation packets
and PPPoE servers send unicast offer packets. Based on the offer packets it receives, a
client will send a request packet to a server. If the request is confirmed, the client will
initiate a PPPoE session. In the course of the discovery communication, the client and
server exchange Ethernet MAC addresses and establish a unique session identifier.
When you create a Spirent TestCenter test, you create a test configuration that defines
emulated host systems. To create a PPPoE test, you configure the host systems with PPP
interfaces and you also configure the host systems to operate as either PPP clients or PPP
servers.
A PppoeClientBlockConfig object defines the characteristics for a set of PPP clients on a
single host. (Likewise, a PppoeServerBlockConfig object defines one or more servers on
a single host.) The number of clients or servers is determined by the host device count.
The following table shows the PPPoE client and server attributes for the different PPPoE
session capabilities.
Client Server
(PppoeClientBlockConfig) (PppoeServerBlockConfig)
Connection AutoRetry –
EnableAutoRetry
Client Server
(PppoeClientBlockConfig) (PppoeServerBlockConfig)
PPPoE Communication
PPPoE communication includes discovery, LCP, and NCP messages. When you use
Spirent TestCenter Automation, you create the object hierarchy, and then, to start
communication, you only need to execute the PPPoxConnect command. Spirent
TestCenter handles discovery, LCP, and NCP negotiation, based on the attribute values of
the PppoeClientBlockConfig and PppoeServerBlockConfig objects.
Once a session is established, you can manage the session by executing Spirent TestCenter
Automation commands, and you can monitor the session by checking attribute values for
the PppoeSessionResults object (such as the SessionState attribute).
The following sections describe:
• The Connect Operation
• Session Termination
• Monitoring a Session
• Pause, Resume, and Retry Operations
Once you have created the object hierarchy, you can use the PppoxConnect or
PppoxConnectWait command to establish one or more PPPoE sessions. The connect
commands use client blocks (PppoeClientBlockConfig objects) to start sessions. For
each client block specified in the command line, Spirent TestCenter starts the number of
sessions implied by the device count for the associated host.
Session Termination
A PPPoE session may terminate for any number of reasons, for example, a connection
goes down, a session peer is unresponsive, or a peer terminates the session explicitly.
Sessions can terminate during any stage of operation - discovery, LCP or NCP
negotiation, or during the session itself. To terminate a session, Spirent TestCenter sends
the appropriate communication according to the current stage of the session. (See RFC
2516 - A Method for Transmitting PPP Over Ethernet (PPPoE) for more details.)
You can terminate a session by invoking the PppoxDisconnect or PppoxDisconnectWait
command. The disconnect commands use client blocks (PppoEClientBlockConfig
objects) to disconnect sessions. For each client block specified in the command line,
Spirent TestCenter disconnects the established sessions.
The following PppoeClientBlockConfig and PppoeServerBlockConfig attributes can
also affect session termination:
• The LcpConfigRequestTimeout attribute specifies the maximum time allowed for
configuration, at which point Spirent TestCenter will transmit another Configure-
Request packet. The LcpConfigRequestMaxAttempts attribute specifies the
maximum number of configuration requests that Spirent TestCenter will send. After
sending LcpConfigRequestMaxAttempts requests (without a corresponding
response), Spirent TestCenter assumes the peer cannot respond and it terminates the
session.
• The LcpTermRequestTimeout attribute specifies the maximum time allowed for
termination, at which point Spirent TestCenter will transmit another Terminate-
Request packet. The LcpTermRequestMaxAttempts attribute specifies the
maximum number of termination requests that Spirent TestCenter will send. After
sending LcpTermRequestMaxAttempts requests (without a corresponding
response), Spirent TestCenter assumes the peer cannot respond and it terminates the
session.
• The MaxNaks attribute specifies the maximum number of Negative-
Acknowlegments allowed during LCP and NCP configuration/negotiation. After
receiving MaxNaks messages, Spirent TestCenter terminates the session.
Monitoring a Session
To monitor client or server state during a session, use the PppoeSessionResults object
attribute SessionState. The following table shows the different state values:
States Description
NONE The SessionState attribute represents the current state for all clients or
IDLE servers associated with a client or server configuration block
CONNECTING (PppoeClientBlockConfig or PppoeServerBlockConfig object). Clients
CONNECTING_FAILED and servers start in the IDLE state.
CONNECTED When you execute the PppoxConnect command, the state changes to
DISCONNECTING CONNECTING. Once all sessions have finished with NCP negotiation, the
state changes to CONNECTED. If there is an error during connection, the
state changes to CONNECTING_FAILED.
When the sessions are disconnected (as a result of executing the
PppoxDisconnect command) the client sends messages to terminate the
session, and the state changes to DISCONNECTING. (Sessions can also be
terminated due to an error, resulting in a state change to DISCONNECTING.)
Once the sessions have been disconnected or terminated, the state changes to
IDLE.
A session state of NONE indicates that the session is in an undefined state.
When you execute the PppoxConnect command, Spirent TestCenter will potentially start a
large number of sessions. Depending on the size of your test configuration, there can be a
significant amount of network traffic as PPPoE peers attempt to establish sessions. Spirent
TestCenter Automation defines a set of commands that you can use to mediate the process
of session setup:
• PppoxPauseCommand – interrupts the overall session setup process. Those sessions
that are already in the process of coming up are allowed to continue. Those sessions
that have not yet started are prevented from starting.
• PppoxResumeCommand – allows those sessions that have not yet started, to start
coming up. Once the sessions are established, the SessionState attribute value
changes to CONNECTED; if the sessions cannot be established, the attribute value
changes to CONNECTING_FAILED.
• PppoxRetryCommand and PppoxRetryWaitCommand – attempt to bring up the
failed sessions.
To get the number of failed sessions, get the value of the failedConnectCount attribute
from the PppoeSessionResults object.
NOTE: When you create your test configuration, you must apply the configuration in
two stages. First, create the objects and apply the configuration. This first apply
transaction will resolve the addresses needed for the binding. After the first apply, set the
binding attributes (above), and call the apply function a second time.
Emulated Host
Emulated Host
PPPoE Client
The figure on page 149 shows the object hierarchy for this simple PPPoE test. The
Project object at the root of the hierarchy has Port and Host objects as children.
The test emulates two hosts with Ethernet, Ipv4 and PPP interfaces. Each host uses a
PPPoE client block to configure multiple clients. In the figure, the generator, analyzer, and
session result objects are shown in red, indicating that Spirent TestCenter creates these
objects automatically.
The figure shows the parent-child relations that Spirent TestCenter establishes
automatically when you create objects. This test configuration also uses additional
relations, such as the AffiliationPort relation. The AffiliationPort relation connects a
Host object with the Port object that identifies the physical port on the Spirent TestCenter
chassis; the emulated host system will use that port for network communication. For
information about the additional relations for this test, see Host Relations.
EthernetFiber
StreamBlock pppoe:PPPoESession
Port 1
Generator GeneratorConfig
Analyzer AnalyzerConfig
EthIIIf
PppoeIf
Host 1
PppIf
Ipv4If
EthIIIf
PppoeIf
Host 2
PppIf
Ipv4If
PppoeClientBlockConfig PPPoESessionResults
EthernetFiber
StreamBlock pppoe:PPPoESession
Port 2
Generator GeneratorConfig
Analyzer AnalyzerConfig
Initialization
Every Spirent TestCenter Automation Tcl script must load the Spirent TestCenter package
before it can use the API. The code fragment on page 150 loads the package, and it also
performs the following setup.
• Defines variables that will be used later in the script. These variables include:
• The chassis, slot, and port location.
• The test duration.
• The number of PPPoE clients to be emulated on a host.
• Creates the Project object that is the root of the object hierarchy.
• Sets automation options to send diagnostic messages to standard output and specify
the minimum severity for logged messages. (The log level is WARN, specifying that
warning and error messages are to be logged.)
Host Emulation
To emulate host systems, the example script:
• Creates Port objects to identify physical ports on Spirent TestCenter chassis.
• Creates a subtree of objects that represent a host system. A Host object is the root of
the subtree; the subtree includes interface objects (EthIIIf, Ipv4If, PppIf, and
PppoeIf objects) and a PPP configuration object (PppoeClientBlockConfig). After
the host emulation is complete, the script will configure relations to associate hosts
with ports, define the interface stacking order, and associate the PPPoE clients with
interfaces (see Host Emulation).
The following sections show example code that creates the host emulation for the PPPoE
test.
• Port Identification
• First Host System Interface Stack
• PPPoE Client Configuration
• First Host System Configuration (Descendant-Attribute Notation)
• Second Host Configuration (at Creation)
Port Identification
The following code fragment creates two Port objects and an EthernetFiber object for
each port to define the physical port interface. When you create a Port object, you specify
chassis, slot, and port location values. Spirent TestCenter will use the port location values
later on to connect to the chassis and then reserve and map the ports. (See Attaching
Ports.)
#############################
### Create the ports under the project
#############################
set port(1) [stc::create Port \
-under $project \
-Location "//$chassisAddress/$slotPort1" ]
#############################
### Create the port type under the port object.
### In this case the port type is fiber.
#############################
set ethernetFiber(1) [stc::create EthernetFiber \
-under $port(1) ]
A host system defines the set of interfaces that will be used for network communication
during the test. You emulate a host system by creating a Host object along with the
appropriate set of interface objects.
The code fragment on page 152 creates two Host objects for the test, and it creates the
interface objects for the first host. The interface objects (EthIIIf, Ipv4If, PppIf, and
PppoeIf objects) are children of Host objects. (The script will create the interface objects
for the second host later, as part of a demonstration of the different methods of configuring
the hosts.)
The script creates each Host object with a device count of 10 (the numberOfClients
value set during initialization). The device count determines the number of PPPoE clients
for the host.
#############################
### Create the hosts that will be used as sources for
### the streamblocks
### Note: The "deviceCount" attribute defines how many
### PPPoE clients are configured on the host/hostblock
#############################
set host(1) [stc::create Host \
-under $project \
-DeviceCount $numberOfClients ]
The PPPoE client configuration for the first host specifies username and password
generation with wildcards. Spirent TestCenter will use the wildcard specifications to
generate username/password combinations in sequence for PPP sessions.
In the following specification, the token “@x” represents one or more characters that will
be generated according to the values in the parentheses.
stc123pwd@x(1,1,1,3,0)
The ordered values in the parentheses define the wildcard generation. Spirent TestCenter
generates an ASCII-Decimal value from the wildcard expression. The syntax of the
wildcard expression is as follows:
@x(start,count,step,pad-width,repeat-count)
• The characters “@x” are a token indicating the position at which Spirent TestCenter
will insert generated characters.
• The start value specifies the initial value for iterative wildcard generation.
• The count value is the number of unique values in the set of generated values. (The
default count is 1. A count value of 0 is limit of an of integer value.)
• The step value is the iteration step value.
• The padwidth value is the minimum width of the generated value. If necessary,
Spirent TestCenter zero fills generated values to produce the minimum width value.
• The repeatcount value defines number of times the generated value should be
repeated before applying the step.
For the example given above – stc123pwd@x(1,1,1,3,0) – the first five generated
values are:
stc123pwd001
stc123pwd001
stc123pwd001
stc123pwd001
stc123pwd001
Spirent TestCenter will repeat the generation cycle to produce as many values as required
for the number of sessions in the test. Spirent TestCenter defines a set of tokens for
wildcard substitution. For more information, see the description of the Username and
Password attributes for the PppoeClientBlockConfig and PppoeServerBlockConfig
objects in the Spirent TestCenter Automation Object Reference.
The code fragment on page 155 creates a PppoeClientBlockConfig object for the second
host, determining the characteristics of the PPP clients on the second host. (Later on, the
script will connect the PppoeClientBlockConfig object to the PPPoE and IPv4 interface
objects on its host; see Host Relations.)
The PPPoE configuration for the second host is similar to that of the first host. The
protocol type, encapsulation, MRU, LCP, and Echo-Request values are the same;
however, the clients for the second host will use the Challenge Handshake Authentication
Protocol (CHAP-MD5) to establish PPPoe sessions. For CHAP-MD5 authentication, the
script specifies the ChapCalRequestTimeout, ChapAckTimeout, and
MaxChapRequestReplyAttempts attributes.
set pppoeClientBlockConfig(2) \
[stc::create "PppoeClientBlockConfig" \
-under $host(2) \
-ChapChalRequestTimeout 3 \
-ChapAckTimeout 3 \
-MaxChapRequestReplyAttempts 10 \
-PadiTimeout 3 \
-PadiMaxAttempts 10 \
-PadrTimeout 3 \
-PadrMaxAttempts 10 \
-IpcpEncap IPV4 \
-Protocol PPPOE \
-EnableMruNegotiation TRUE \
-EnableMagicNum TRUE \
-Authentication CHAP_MD5 \
-IncludeTxChapId TRUE \
-MruSize 1384 \
-UserName sTestCenter \
-Password stc123 ]
The following code fragment shows the use of Descendant-Attribute Notation (DAN) to
set the attributes of the interface objects. When you use DAN, you specify a path name
consisting of a sequence of one or more object type names, ending with an attribute name.
The names are separated by dots. (For more detailed information, see Descendant-
Attribute Notation (DAN).)
In the example on page 157, a single call to the config function configures all of the
interfaces for the first host (host(1)). Each attribute specification includes the object type
of the interface object and the attribute name. For example, the source MAC address for
the host is specified as follows:
-EthIIIf.SourceMac 00:10:94:00:00:02
The EthIIIf.SourceMac DAN specification, combined with the host(1) object
specification, identifies the SourceMac attribute for the EthIIIf Ethernet interface object
that is a child of the first Host object.
The following code fragment configures the second host when it creates the interface
objects for that host. The code fragment creates each interface object (EthIIIf, PPPoeIf,
PppIf, and Ipv4If), specifying the configuration values at the time of creation.
puts "Creating/configuring the second host's EthernetII interface..."
#############################
### Create/configure the Ethernet II interface for the second host
#############################
set ethIIIf(2) [stc::create EthIIIf \
-under $host(2) \
-SourceMac 00:10:94:00:01:03 ]
#############################
### Create/configure the PPP/PPPoE interfaces for the second host
#############################
set pppoeIf(2) [stc::create PppoeIf \
-under $host(2) \
-SessionId 0 \
-SessionIdStep 1 \
-SessionResolver PppoeProtocol ]
#############################
### Create/configure the IPv4 interface for the second host
#############################
set ipv4If(2) [stc::create Ipv4If \
-under $host(2) \
-AddrResolver PppoeProtocol \
-ResolveGatewayMac TRUE \
-GatewayMacResolver default ]
Host Relations
Up to this point, the connections between objects in the test configuration have been
defined by the parent-child relations that Spirent TestCenter automatically configures
when you create objects. Spirent TestCenter requires additional relations between objects
in order to support various operations of the test configuration.
For this test, the example script configures the following relations:
• The AffiliationPort relation defines the connection between an emulated host and the
Spirent TestCenter port that the host will use. To define this connection, you configure
an AffiliatedPort relation between a Host object and the appropriate Port object.
• The TopLevelIf relation identifies the initial interface in the host interface stacking
order.
• The PrimaryIf relation identifies the top level interface (TopLevelIf) that faces the
DUT.
• StackedOnEndpoint relations define the stacking order of the interfaces on an
emulated host.
• The UsesIf relation identifies the interfaces that the PPP client uses. To define this
type of connection, configure a UsesIf relation between a PppoEClientBlockConfig
object and the set of interface objects that it uses.
The following code fragment shows the config function calls that create these relations.
When you configure a relation, you specify the object that will act as one side of the
relation, followed by the relation specification, which identifies the other side of the
relation. For example:
stc::config $host(1) -AffiliatedPort $port(1)
This call to config specifies host(1) as the source of the relation, and port(1) as the target.
puts "Setting up the relations for the hosts to the port objects..."
The following figure shows the relations for the first host-port configuration. (The
relations for the second port-host configuration are identical.)
Project
Port 1
AffiliationPort
Host 1
PppoeClientBlockConfig
EthIIIf
UsesIf
StackedOnEndpoint
TopLevelIf
PppoeIf
PrimaryIf
StackedOnEndpoint
PppIf UsesIf
StackedOnEndpoint
Ipv4If
objects. for the port. (See the object hierarchy diagram in Example Test Configuration to
see these objects in the hierarchy.)
The following code fragment configures the generators for each port.
#############################
### Configure the generator attributes
#############################
stc::config $port(1).generator.generatorConfig \
-SchedulingMode PORT_BASED \
-Duration $runtime \
-DurationMode SECONDS \
-LoadUnit PERCENT_LINE_RATE \
-LoadMode FIXED \
-FixedLoad 10.000000
stc::config $port(2).generator.generatorConfig \
-SchedulingMode PORT_BASED \
-Duration $runtime \
-DurationMode SECONDS \
-LoadUnit PERCENT_LINE_RATE \
-LoadMode FIXED \
-FixedLoad 10.000000
The calls to the config function use Direct-Descendant Notation (DDN) to set the
attributes for the GeneratorConfig object. For example:
$port(1).generator.generatorConfig
The object specification consists of the Port object handle – $port(1) – followed by a
sequence of object types (separated by periods). The sequence represents objects in the
port parent-child descendant path in the test hierarchy. Note that DDN allows you to set
multiple attributes of the GeneratorConfig object without having to retrieve the
Generator or GeneratorConfig handles.
The following code fragment also uses DDN paths to configure the analyzers on the ports.
stc::config $port(1).analyzer.analyzerConfig \
-TimestampLatchMode START_OF_FRAME \
-SigMode ENHANCED_DETECTION \
-HistogramMode INTERARRIVAL_TIME
stc::config $port(2).analyzer.analyzerConfig \
-TimestampLatchMode START_OF_FRAME \
-SigMode ENHANCED_DETECTION \
-HistogramMode INTERARRIVAL_TIME
Attaching Ports
To run the test, you must:
• Connect to chassis.
• Reserve the ports that you intend to use.
• Map the reserved ports.
You can perform these operations by calling the connect and reserve functions, and then
use the MapPort command. As an alternative, you can accomplish all three by using the
AttachPorts command. The AttachPorts command uses the location defined in the Port
objects to connect to the chassis and reserve the ports, after which it creates the mapping
between the physical ports and their logical representation in the test configuration. The
following code fragment demonstrates the use of the AttachPorts command, after which
it applies the test configuration.
#############################
### Apply the previously created configuration
#############################
stc::apply
Results Subscription
To enable the collection of test results, you must establish subscriptions for result
attributes. Use the subscribe function to establish subscriptions and to direct Spirent
TestCenter Automation to produce result files. Refer to the code fragment on page 163.
In the following calls to the subscribe function:
• The –parent parameter is required, and for its value, you must specify the handle for
the Project object in your test configuration.
• The –configType parameter determines the configuration type.
• The –resultType parameter identifies the type of results to be collected. Note that
Spirent TestCenter automatically creates result objects as needed.
• The –filenamePrefix parameter specifies the name of the results file (formatted as
comma-separated values, .csv file extension). You must specify a prefix to generate
results output files.
By default, for all the subscriptions, Spirent TestCenter will collect results for the entire
configuration. To override this default, and limit results collection, use the –resultParent
parameter. (The default is the equivalent of specifying -resultParent $project,
collecting any results associated with objects that are descendants of the Project object.)
For more information, see the description of the subscribe function.
#############################
### Subscribing to results
#############################
set resultDataSet1 [stc::subscribe -Parent $project \
-ConfigType Analyzer \
-resulttype AnalyzerPortResults \
-filenameprefix analyzer_port_counters ]
PPPoE Sessions
Spirent TestCenter uses the PPPoE client (or server) configuration to establish PPPoE
sessions – in this example, client configuration, defined in the PppoeClientBlockConfig
objects. Once the sessions are established, the script can configure traffic, including
PPPoE headers.
The following sections contain code examples that start PPP sessions and configure PPP
traffic.
• Establishing PPPoE Sessions
• Session State
• PPPoE Session Traffic
The following code fragment executes the PPPoXConnect command to start the PPP
sessions. After waiting 5 seconds for the sessions to be established, the script executes the
PPPoXSessionInfo command to retrieve session data from the chassis.
#############################
### Wait for a few seconds to allow the PPPoE sessions to connect
#############################
stc::sleep 5
stc::perform PppoxSessionInfo \
-blockList "$pppoeClientBlockConfig(1) $pppoeClientBlockConfig(2)"
Session State
Once the session data has been retrieved, the script executes a loop that performs the
following:
• Retrieves the PPPoESessionResults children of the PPPoEClientBlockConfig
object. Spirent TestCenter creates the PPPoESessionResults object automatically to
store the session data.
• For each client, the script retrieves the session state, and if the session is connected,
the script retrieves the IP address for the session.
#############################
### Retrieve the session state and IP address from the session
### results. Each session has numberOfClients defined, and as
### a result each client has a state and an IP address. There are
### many other result fields that can be retrieved.
#############################
puts ""
puts "Session State IP Address"
puts ""
}
To configure PPPoE session traffic for a host, the script creates a StreamBlock object and
a PppoeSession header object. After creating these objects (for both hosts), the script sets
the source and destination bindings for the streams.
NOTE: The StreamBlock source and destination bindings are established after the PPP
sessions are started. This is necessary to take advantage of the IP addresses that are
associated with the PPP sessions. (If the bindings had been established before the sessions
were started, the traffic would use the default IP addresses, which would not be part of the
PPP sessions.)
The following code fragment creates StreamBlock and PppoeSession objects for each
port.
######################################
###### Create stream blocks (one per port)
######################################
set streamBlock(1) [stc::create streamBlock -under $port(1)]
set streamBlock(2) [stc::create streamBlock -under $port(2)]
#############################
### Create/configure the PPPoE interface for the first streamblock
#############################
set strBlkPppoe(1) [stc::create pppoe:PPPoESession \
-under $streamBlock(1)]
#############################
### Create/configure the PPPoE interface for the second streamblock
#############################
set strBlkPppoe(2) [stc::create pppoe:PPPoESession \
-under $streamBlock(2)]
The PppoeSession header is a Protocol Data Unit (PDU) object that is a child of a
StreamBlock object. To use PDU objects that are direct children of StreamBlock objects,
you must use the PDU library prefix for the object:
stc::create pppoe:PPPoESession -under $streamBlock(1)
(The PDU library name is shown as the prefix in the Spirent TestCenter Automation
Object Reference, at the top of the documentation page for PDU objects that are
StreamBlock children.)
NOTE: For the remaining traffic headers, Spirent TestCenter will use the stacked
interfaces configured on the emulated hosts to generate headers in the traffic frames.
The following code fragment creates the the source and destination bindings for the traffic
streams. The script creates SrcBinding and DstBinding relations for the StreamBlock
associated with each port, so that the two hosts will send traffic to each other. For each
host:
• The SrcBinding relation connects the local StreamBlock with the local Ipv4
interface (the Ipv4If object).
• The DstBinding relation connects the local StreamBlock with the remote Ipv4
interface (the Ipv4If object).
######################################
##### Note: The streamblock relations are created after
##### the PPPoX sessions have been connected so that the bindings
##### will work corrrectly. Creating the bindings before the
##### sessions are connected will not give the correct IP addresses
######################################
#############################
### Setup the relations for the bindings in the streamblocks
### The source is the PPPoE host on each port, and the destination
### is the PPPoE host configured on the other port
#############################
stc::config $streamBlock(1) -SrcBinding $ipv4If(1)
stc::config $streamBlock(1) -DstBinding $ipv4If(2)
stc::config $streamBlock(2) -SrcBinding $ipv4If(2)
stc::config $streamBlock(2) -DstBinding $ipv4If(1)
The following figure shows the source and destination bindings for the traffic streams.
Project
Port 1
StreamBlock
pppoe:PPPoESession
DstBinding
Host 1
SrcBinding
Ipv4If
PppoeClientBlockConfig
Host 2
DstBinding
Ipv4If
PppoeClientBlockConfig
SrcBinding
Port 2
StreamBlock
pppoe:PPPoESession
Test Execution
To run a Spirent TestCenter Automation test, you must start the generator(s) to send
traffic, and the analyzer(s) to collect results. The following sections show the different
aspects of test execution:
• Generator/Analyzer Set Up
• Execution
• Termination
Generator/Analyzer Set Up
#############################
### Find the current generators
#############################
set generatorCurrent(1) [stc::get $port(1) -children-generator]
set generatorCurrent(2) [stc::get $port(2) -children-generator]
#############################
### Find the current analyzers
#############################
set analyzerCurrent(1) [stc::get $port(1) -children-analyzer]
set analyzerCurrent(2) [stc::get $port(2) -children-analyzer]
#############################
### Stop the analyzers to put the system in a known good state
#############################
stc::perform analyzerStop -analyzerList "$analyzerCurrent(1) $analyzerCurrent(2)"
#############################
### Start the analyzers
#############################
stc::perform analyzerStart -analyzerList "$analyzerCurrent(1) $analyzerCurrent(2)"
#############################
### Apply the configuration after the streams have been modified
#############################
stc::apply
puts "Configuration applied successfully"
Execution
The following code fragment starts traffic generation, waits for the pre-determined time
period, and then stops the generators and analyzers.
puts "Starting traffic on all ports..."
#############################
### Start the generators
#############################
stc::perform generatorStart \
-generatorList "$generatorCurrent(1) $generatorCurrent(2)"
stc::sleep $runtime
#############################
### Stop the generators
#############################
stc::perform generatorStop -generatorList "$generatorCurrent(1) $generatorCurrent(2)"
#############################
### Stop the anyalyzers
#############################
stc::perform analyzerStop -analyzerList "$analyzerCurrent(1) $analyzerCurrent(2)"
Termination
The following code fragment shows an example of the function calls that you use to
perform termination.
puts "Disconnecting PPPoE sessions on all ports..."
#############################
### Disconnecting PPPoE sessions
#############################
stc::perform PPPoXDisconnect \
-blockList "$pppoeClientBlockConfig(1) $pppoeClientBlockConfig(2)"
#############################
### Wait for a few seconds to allow the PPPoE sessions to disconnect
#############################
stc::sleep 5
#############################
### Release Ports
#############################
stc::perform detachPorts -portList "$port(1) $port(2)"
puts "Releasing the ports complete"
#############################
### Disconnect
#############################
stc::perform chassisdisconnectall
Spirent
TestCenter Emulated Port A
Chassis BGP Router
DUT
Emulated
BGP Router Port B
BgpGlobalConfig
Port A Generator
EthIIIf
Port B Analyzer
EthIIIf
OPEN The command ProtocolStart begins the session for each of the
emulated routers associated with the specified BgpRouterConfig
objects
In the Spirent TestCenter environment, an emulated BGP speaker
either initiates a session by sending an OPEN message, or it listens for
OPEN messages. By default, Spirent TestCenter BGP speakers
initiate sessions. To use a speaker as a listener at the beginning of a
session, set the BgpRouterConfig attribute Initiate to FALSE. (Note
that if a Spirent TestCenter BGP speaker is set to initiate a session, it
will still accept an OPEN message to start a session.)
Prior to invoking ProtocolStart, an emulated router is in the IDLE
state. As a result of starting the session, the router will transition
through the following states:
• CONNECT
• ACTIVE
• OPEN_SENT
• OPEN_CONFIRM
Once the session is confirmed by the peer, the router changes its state
to ESTABLISHED. The state is represented in the BgpRouterConfig
attribute RouterState.
During a session, Spirent TestCenter advertises routes based on the attributes of the
BgpRouterConfig, route configuration (for example, BgpIpv6RouteConfig), and
network block objects. The initial UPDATE messages contains all of the routes that are
defined at the start of the session. After sending the initial version of the routing table, a
speaker sends subsequent UPDATE messages only if the routing table changes. You can
make changes to the emulated router by modifying the objects. You must call the Spirent
TestCenter Automation function apply to send the changes to the module on the Spirent
TestCenter chassis. Spirent TestCenter sends an UPDATE message to communicate the
changes according to the updateDelay timing.
Withdrawing Routes
Initialization
Every Spirent TestCenter Automation Tcl script must load the Spirent TestCenter package
before it can use the API. The following code fragment loads the package, and it also
defines variables that will be used later in the script. These variables control capture and
specify the IP address of the chassis along with the slot and port numbers. Note that the
first statement begins a Tcl catch block that contains the entire script.
if {[catch {
package require SpirentTestCenter
set ENABLE_CAPTURE 1
# Physical topology
set szChassisIp 10.98.6.12
set iSlotA 12
set iPortA 1
set iSlotB 12
set iPortB 3
# Create ports
set hPortA [stc::create port -under $hProject \
-location //$szChassisIp/$iSlotA/$iPortA \
-useDefaultHost False ]
set hPortB [stc::create port -under $hProject \
-location //$szChassisIp/$iSlotB/$iPortB \
-useDefaultHost False ]
# Attach ports.
puts "...[clock format [clock seconds] -format %m-%d-%Y%l:%M:%S%p]
Attaching PortList ..."
# Initialize generator/analyzer.
puts "...Initialize generator/analyzer..."
set hGenerator [stc::get $hPortA -children-Generator]
set hAnalyzer [stc::get $hPortB -children-Analyzer]
Global Configuration
The BgpGlobalConfig object defines global values for emulated router settings. The
object attributes affect the following behavior for all emulated BGP routers represented in
the object hierarchy:
• Connection (the ConnectionRetryCount and ConnectionRetryInterval attributes)
• Session startup and shutdown (the SequentialStartup, StaggerOpen, and
StaggerClose attributes)
• Update message control (the UpdateCount and UpdateDelay attributes)
• VPLS version (the VplsDraftVersion attribute)
See the Spirent TestCenter Automation Object Reference for details about these attributes.
The following code fragment retrieves the handle to the automatically created
BgpGlobalConfig object. The script will use the handle later, to manage route flapping
(see Route Flapping).
# BgpGlobalConfig
set hBgpGlobalConfig [stc::get $hProject -children-BgpGlobalConfig]
Router configuration involves setting up interfaces for protocols. The following code
fragment creates a Router object and objects for Ethernet and IPv6 interfaces. Then it
configures the router as a BGP speaker. The test uses the following objects (see the Spirent
TestCenter Automation Object Reference for the complete definition of these objects):
• The Router object is a child of the Project object.
• The EthIIIf object specifies the MAC address(es) for the router’s Ethernet
interface(s). The EthIIIf object is a child of the Router object.
• The script creates an Ipv6If object for the router’s link-local IPv6 interface. A child of
the Router object, the Ipv6If object specifies IPv6 address(es), gateway addresses,
and other characteristics.
• The script creates an Ipv6If object for the router’s global IPv6 interface. A child of
the Router object, the Ipv6If object specifies IPv6 address(es), gateway addresses,
and other characteristics.
• The BgpRouterConfig object defines characterstics for an emulated BGP speaker. A
child of the Router object, the BgpRouterConfig object identifies the emulated
speaker (the AsNum attribute), the BGP peer (the DutIpv6Addr and PeerAs
attributes) and the IP version (the IpVersion attribute), and it specifies other speaker
characteristics.
• The BgpIpv6RouteConfig object defines characteristics for BGP IPv6 routes; for
example, AS path information (the AsPath and AsPathSegmentType attributes) and
origin information for UPDATE messages (the Origin attribute). The
BgpIpv6RouteConfig object is a child of the BgpRouterConfig object.
• The Ipv6NetworkBlock object is an automatically created child of the
BgpIpv6RouteConfig object. The script uses the network block object to define a
range of IPv6 addresses.
# Ipv6If IP address
set hIPv6IfGlobalAddrPortA [stc::create "Ipv6If" -under $hRouterA \
-Address "2000:50::3" -PrefixLength "64" \
-Gateway "2000:50::1" -GatewayMac "00:09:b6:f6:c0:08"]
# BgpRouterConfig
set hBgpRouterConfigPortA [stc::create "BgpRouterConfig" -under $hRouterA \
-DutIpv6Addr "2000:50::1" -IpVersion "IPV6" \
-PeerAs 65503 -AsNum 65504 -Name "Port A router"]
# BgpIpv6RouteConfig
set hBgpIPv6RouteConfigPortA [stc::create "BgpIpv6RouteConfig" \
-under $hBgpRouterConfigPortA -Origin "IGP" \
-AsPath "65504" -AsPathSegmentType "SEQUENCE" -RouteCategory "UNIQUE"]
# Ipv6NetworkBlock
set hIpv6NetworkBlockPortA [stc::get $hBgpIPv6RouteConfigPortA \
-children-Ipv6NetworkBlock]
stc::config $hIpv6NetworkBlockPortA \
-StartIpList "2000::" -PrefixLength "64" -NetworkCount "1000" \
-AddrIncrement "2" -Active "TRUE" -Name "BGP Route 2000::-2000:0:0:7ce::/64,+2"
Up to this point, the connections between objects in the test configuration have been
defined by the parent-child relations that Spirent TestCenter automatically configures
when you create objects. Spirent TestCenter requires additional, non-parent-child relations
between objects in order to support various operations on the test configuration.
For this test, the example script uses the following relations:
• The TopLevelIf relation identifies the initial interface(s) in the router interface
stacking order. In this configuration, the top level interface uses two IPv6 interfaces –
the link-local and global address interfaces.
The following figure shows the relations for the first BGP router configuration. (The
relations for the second BGP router configuration are identical.)
Project
Port A
AffiliatedPort
Router A
PrimaryIf
EthIIIf
StackedOn StackedOn PrimaryIf
UsesIf
UsesIf
BgpRouterConfig
The following code segments repeat the configuration code for the second BGP speaker.
First, create the configuration:
# Ipv6If IP address
set hIPv6IfGlobalAddrPortB [stc::create "Ipv6If" -under $hRouterB \
-Address "2000:51::3" -PrefixLength "64" \
-Gateway "2000:51::1" -GatewayMac "00:09:b6:f6:c0:06"]
# BgpRouterConfig
set hBgpRouterConfigPortB [stc::create "BgpRouterConfig" -under $hRouterB \
-DutIpv6Addr "2000:51::1" -IpVersion "IPV6" -PeerAs 65503 \
-AsNum 65505 -Name "Port B router"]
# BgpIpv6RouteConfig
set hBgpIPv6RouteConfigPortB [stc::create "BgpIpv6RouteConfig" \
-under $hBgpRouterConfigPortB -Origin "IGP" -AsPath "65505" \
-AsPathSegmentType "SEQUENCE" -RouteCategory "UNIQUE"]
# Ipv6NetworkBlock
set hIpv6NetworkBlockPortB [stc::get $hBgpIPv6RouteConfigPortB \
-children-Ipv6NetworkBlock]
stc::config $hIpv6NetworkBlockPortB \
-StartIpList "2000::16" -PrefixLength "64" -NetworkCount "1000" \
-AddrIncrement "2" -Active "TRUE" \
-Name "BGP Route 2000::16-2000:16:0:7ce::/64,+2"
stc::config $hRouterB \
-PrimaryIf "$hIPv6IfLinkLocalAddrPortB $hIPv6IfGlobalAddrPortB"
Test Execution
The following sections describe the elements of test execution for the BGP test:
• Starting the BGP Protocol
• Error Handling (Sessions Not Established)
• Route Flapping
• Stop Protocol; Save Capture
To start BGP sessions, use the ProtocolStart command. The command uses router
configuration object(s) – in this case, BgpRouterConfig objects – to identify the protocol
type. Spirent TestCenter will generate the appropriate messages to start and maintain the
protocol sessions (OPEN, UPDATE, and KEEPALIVE messages for BGP sessions).
The following code fragment invokes ProtocolStart and uses the WaitForRouterState
command to determine the session state for each router. WaitForRouterState will return
control to the script if either session reaches the ESTABLISHED state, or the -WaitTime
attribute setting expires. The script uses a Tcl catch statement to handle errors in
establishing sessions (see Error Handling (Sessions Not Established)).
The following code fragment handles the condition where sessions cannot be established.
The script:
• Displays the router states for failed sessions.
• Stops capture, saves the capture data to a file, and displays the captured frame count.
• Terminates the test (detaches ports and deletes the Project object), and exits.
# Detach ports.
stc::perform detachPorts -portList [list $hPortA $hPortB]
# Delete configuration
puts "Deleting project"
stc::delete $hProject
return
}
Route Flapping
performance degrades due to the increased routing communication and due to the time it
takes for routers to reconfigure the routing tables.
The following code fragment introduces flapping into the BGP test environment. The
script uses a loop based on message timing to advertise and withdraw routes. The script:
• Uses the BgpGlobalConfig object attributes -UpdateDelay and -UpdateCount to
configure BGP Update message transmission.
• Invokes the BgpWithdrawRoute command to withdraw routes, and then uses the
WaitForRoutingEvents command to wait 30 seconds for all routing commands to
complete.
• Invokes the BgpReadvertiseRoute command to start transmitting Update messages
again, and then uses the WaitForRoutingEvents command to wait 30 seconds for all
routing commands to complete.
# Configure delay times between successive BGP Update messages (in milliseconds).
set lstUpdateDelayTimes [list 100 90 80 70 60 50 40 30 20 10 1]
Cleanup
At the end of test execution, the script:
• Releases the reserved ports. The script uses the detachPorts command to release the
ports.
• Deletes the Project object.
The following code fragment shows an example of the function calls that you use to
perform termination. It also contains the end of the outermost Tcl catch block that
encompasses the entire script.
# Detach ports.
stc::perform detachPorts -portList [list $hPortA $hPortB]
# Delete configuration
stc::delete $hProject
} err] } {
puts "Error caught: $err"
}
subscribe 93
subscribe function 44
Subscriptions 92
DiffServResults, FilteredStreamResults
restriction 92
example 71, 103, 119, 162, 185
result output file 93
Syntax, API 9
Descendant-Attribute Notation (DAN) 14
Direct-Descendant Notation (DDN) 13
filtered retrieval (stc::get) 16
indexed notation 14
object handle 12
path notation 13
relation reference 15
T
Table modifier 124
Tcl catch 54
Tcl error handling 91
Tcl package for Spirent TestCenter 55
Test results
paged results 97
retrieving 94
TopLevelIf relation 79
Tracking packets by signature field 130
Traffic binding (relations) 167
Traffic generators 122
Trigger (CaptureAnalyzerFilter) 140
U
unsubscribe function 47
Using object handles 12
W
waitUntilComplete function 48