Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter...

62
Essentials of Spirent TestCenter GUI to Script Automation Introduction 1

Transcript of Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter...

Page 1: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Essentials of Spirent TestCenter GUI to Script Automation

Introduction1

Page 2: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Course Description

The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the features and functions of the Save As Script menu item contained within the Spirent TestCenter GUI.

Since it is a web-based course, you can choose to view only the topics of interest or the entire course.

Viewing all the topics within the course will take just under 30 minutes.

Introduction

2

Page 3: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Course Objectives After completing this course, participants will be able to:

Generate and run TCL, Ruby, and Perl scripts created using the Save As Script feature.

Identify and describe the key elements contained with the files generated from the Save As Script feature.

Describe the purpose of the Save As Script Additional Processing Options.

Download and install HLTAPI.

Generate HLTAPI scripts using the Save As Script feature.

Introduction

3

Page 4: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Spirent TestCenter GUI to Script Automation Overview

GUI to Script Content

Additional Processing Options

HLTAPI

Course Topics Overview

4

Page 5: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Essentials of Spirent TestCenter GUI to Script Automation

GUI to Script Automation Overview5

Page 6: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Spirent TestCenter GUI to Script Automation Overview

GUI to Script Content

Additional Processing Options

HLTAPI

Course Topics Overview

6

Page 7: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

GUI to Script OverviewSpirent TestCenter GUI to Script Automation Overview

The GUI to Script option enables automation on Spirent TestCenter without the typical automation overhead.

Simply configure the test within the GUI.

With the click of a button, generate the Test Script

Then execute the Test Script from a Shell.

7

Page 8: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

GUI to Script BenefitsSpirent TestCenter GUI to Script Automation Overview

Extremely easy to create Spirent TestCenter automated test configuration.

Extremely easy to create a complete Spirent TestCenter automated test.

Automation skills NOT required.

Reduce time for writing a test case.

Minimizing errors in writing test scripts manually.

8

Page 9: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

GUI to Script Limitations

Hard coded scripts.

Spirent TestCenter GUI to Script Automation Overview

Must use the Command Sequencer in the GUI in order to have a complete Spirent TestCenter automated test.

9

Page 10: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Spirent TestCenter Test ConfigurationSpirent TestCenter GUI to Script Automation Overview

10

Page 11: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Test Configuration Script GenerationSpirent TestCenter GUI to Script Automation Overview

11

Page 12: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Additional Automation Processing Options*Spirent TestCenter GUI to Script Automation Overview

12

Page 13: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Naming the ScriptsSpirent TestCenter GUI to Script Automation Overview

13

Page 14: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Generated FilesSpirent TestCenter GUI to Script Automation Overview

The Launcher script sources the Logic script.

The Logic script configures the test, executes the test, may send the traffic, may gather the results and disconnects from the chassis.

The XML file contains configuration data*.

14

Page 15: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Executing a GUI to Script Test You will execute your scripts generated by the GUI to Script feature

from an environment Shell (Tcl/Ruby/Perl).

Spirent TestCenter GUI to Script Automation Overview

With Tcl for example, you can execute the Launcher script either from a DoS prompt:>tclsh <Launcher Script Name>.tcl

>tclsh Save_Tcl.tcl

Or, from the Tcl Shell using the source command:% source <Launcher Script Name>.tcl

% source Save_Tcl.tcl

15

Page 16: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Script ResultsSpirent TestCenter GUI to Script Automation Overview

16

Page 17: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Essentials of Spirent TestCenter GUI to Script Automation

GUI to Script Content17

Page 18: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Spirent TestCenter GUI to Script Automation Overview

GUI to Script Content

Additional Processing Options

HLTAPI

Course Topics Overview

18

Page 19: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

GUI to Script Generated Files

Save As Script Menu item generates:

GUI to Script Contents

<Name>.tcl/pl/rb (Launcher file) <Name>_logic.tcl/pl/rb (Logic file) <Name>.xml (Configuration file)*.

19

Page 20: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Logic Script

Logic file contains the following procedures: init - Sets logging level and file locations configResultLocation - Sets the Results Location configMiscOptions - Sets the Sequencer to Stop on Error config - Defines configuration/Sets Port locations/Specifies the protocol

stack linkages for both the stream blocks and any configured protocols connect - Connect to the Chassis/Reserve Ports/Map Logical to Physical Ports apply - Download the Test Configuration to the Chassis run - Subscribe to Results/Start the Command Sequencer cleanup - Release Ports/Disconnect from Chassis/Reset Configuration

GUI to Script Contents

20

Page 21: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Configuration XML File

When Configuration XML file is created:

XML file contains all of the test configuration definitions.

Logic Script contains all the same procedures (init, config, run, etc.), however, these procedures do not contain test configuration definitions since the definitions are passed from the XML file, making the Logic file much smaller in size.

You can open the XML file in the GUI allowing a Script to GUI configuration.

GUI to Script Contents

21

Page 22: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Launcher File Launcher file: Calls in the Logic script Invokes procedures defined within the Logic script Passes Chassis/Slot/Port List into the config procedure Returns test status

GUI to Script Contents

22

Page 23: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Essentials of Spirent TestCenter GUI to Script AutomationAdditional Processing Options

23

Page 24: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Spirent TestCenter GUI to Script Automation Overview

GUI to Script Content

Additional Processing Options

HLTAPI

Course Topics Overview

24

Page 25: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Additional Automation Processing Options*Additional Processing Options

25

Page 26: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Script to Run Before Disconnect Populating the Script to Run Before Disconnect will:

Additional Processing Options

Run the stated script before the disconnecting from the Spirent TestCenter chassis.

Use these scripts to perform actions such as checking device status.

26

Page 27: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Prefix Procedures Populating the Prefix Procedures with will:

Additional Processing Options

Add stated name to prefix of all procedures within the Logic script. Add stated name to prefix of all procedure calls within the Launcher script.

27

Page 28: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Encapsulate Procedures Populating the Encapsulate Procedures in Namespace will:

Additional Processing Options

Encapsulate all procedures within the Logic script. Add stated namespace to the Launcher script.

28

Page 29: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Do Not Save Default Values Unchecking the Do Not Save Default Values will:

Additional Processing Options

Present all Objects within the Logic script. Doubles the size of the Logic Script.

29

Page 30: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Use Default Values for Rarely Modified Settings Checking the Use Default Values for Rarely Modified Settings will:

Additional Processing Options

Further reduce the size of the Logic Script.

30

Page 31: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Save the Configuration Data in XML File Using the Save the Configuration Data in Separate XML File will:

Additional Processing Options

Create an XML File that contains the test configuration data. Allows XML File to populate GUI.

31

Page 32: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Create Custom Launcher Script If you use Create Custom Launcher Script you must:

Additional Processing Options

Retrieve parameters using the following Tcl call: $stc::scriptParameters(-varName)

32

Page 33: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

File Path Substitutions Using Create basePathMap Variable with the Following

Replacements will:

Additional Processing Options

Allow you to create a Replace/With Table that is inserted into Launcher Script.

33

Page 34: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Essentials of Spirent TestCenter GUI to Script AutomationHLTAPI

34

Page 35: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Spirent TestCenter GUI to Script Automation Overview

GUI to Script Content

Additional Processing Options

HLTAPI

Course Topics Overview

35

Page 36: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Spirent HLTAPI Description Spirent HLTAPI (High Level Test API) is designed to hide the lower

level APIs of Spirent TestCenter. This greatly reduces the need for any test script changes if there are changes to Spirent's lower level APIs in newer releases.

Spirent HLTAPI supports Tcl, Perl and Python. Depending on automation preferences or requirements, test specialists can use any of these languages for tests.

Spirent HLTAPI is a self-contained package built on top of the Spirent TestCenter native API library. In order to use the Spirent HLTAPI, the Spirent TestCenter native API library is required.

HLTAPI

36

Page 37: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Download Spirent TestCenter HLTAPI Download the Spirent TestCenter HLTAPI from

support.spirent.com

Install Spirent TestCenter HLTAPI

37

Page 38: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Unzip HLTAPI Install Spirent TestCenter HLTAPI

Unzip the downloaded HLTAPI package to a folder (such as C:/HLTAPI_4.52_GA).

38

Page 39: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Modify TCLLIBPATH

Add the “C:/HLTAPI_4.52_GA/SourceCode” into the Windows Environment Variable TCLLIBPATH.

Install Spirent TestCenter HLTAPI

39

Page 40: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Verify Installation Launch a Tcl shell and type “package require SpirentHltApi”. The

version information indicates that you have successfully installed HLTAPI.

Install Spirent TestCenter HLTAPI

40

Page 41: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Register HLTAPI in Spirent TestCenter To register the Save as HLTAPI tool in Spirent TestCenter: Launch Spirent TestCenter. From the menu bar, select Tools > Options >

Tcl/Tk to make sure the Tcl/Tk installation path is correct (C:\Tcl).

Install Spirent TestCenter HLTAPI

41

Page 42: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Register HLTAPI in Spirent TestCenter Continued Launch the command line window and type the following command: tclsh C:\HLTAPI_4.52_GA\SourceCode\tools\toolRegister.tcl 4.56

Install Spirent TestCenter HLTAPI

Ensure the .property file (C:\HLTAPI_4.52_GA\SourceCode\tools) is NOT “Read-only”.

42

Page 43: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Close Spirent TestCenter Close Spirent TestCenter GUI.

Install Spirent TestCenter HLTAPI

This completes the installation of the Spirent TestCenter HLTAPI.43

Page 44: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

HLTAPI Documentation HLTAPI Documentation is located in the folder of

C:\HLTAPI_4.52_GA\UserDoc after HLTAPI installation.

Install Spirent TestCenter HLTAPI

44

Page 45: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Launch the Save as HLTAPI Wizard Open Spirent TestCenter. In the menu bar, go to Tools > Custom Tools, and click Save as

HLTAPI.

Save as HLTAPI Wizard

45

Page 46: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Save as HLTAPI WizardSave as HLTAPI Wizard

46

Page 47: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Save as HLTAPI Wizard Options See Appendix A within the STC Automation HLTAPI Command

Reference for definitions of the Wizard Options.

Save as HLTAPI Wizard

47

Page 48: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

HLTAPI Limitations

The arguments of HLTAPI do not have a one-to-one correlation with Spirent Test Center's native API objects.

Some functions and arguments are not supported by Save as HLTAPI. In these cases, you would have to modify the script manually.

Save as HLTAPI Wizard

48

Page 49: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Save as HLTAPI for Tcl

Select radio button HLTAPI for Tcl (default)

Select the Browse button

Select a file folder

Select the Generate button

HLTAPI for TCL

49

Page 50: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Save as HLTAPI for Tcl Select Yes if you wish to view the generated script.

HLTAPI for TCL

50

Page 51: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Execute HLTAPI Tcl Script Make sure the test ports are available and source the generated

script in Tcl shell: source Test_hltapi.tcl

HLTAPI for TCL

51

Page 52: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Save as HLTAPI for PerlHLTAPI for Perl

Select radio button HLTAPI for Perl

Select the Browse button

Select a file folder

Select the Generate button

52

Page 53: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Save as HLTAPI for PerlHLTAPI for Perl

Select Yes if you wish to view the generated script.

53

Page 54: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Setup HLTAPI Perl Execution Environment Install Perl in a folder such as C:\Perl.

HLTAPI for Perl

Copy the HLTAPI for Perl library files, hltapiserver.srv and sth.pm (from the SourceCode\hltapiForPerl folder) to your Perl library such as C:\Perl\site\lib.

Perl LibraryC:\Perl\site\lib

54

Page 55: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Setup HLTAPI Perl Execution Environment Continued Add the variable value C:/Tcl/bin/tclsh (no quotation marks) into

the Windows Environment Variable STC_TCL.

HLTAPI Perl requires this environment variable.

HLTAPI for Perl

55

Page 56: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Execute HLTAPI Perl Script Make sure the test ports available and run HLTAPI for Perl script:

perl Test_hltapi.pl

HLTAPI for Perl

56

Page 57: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Save as HLTAPI for PythonHLTAPI for Python

Select radio button HLTAPI for Python

Select the Browse button

Select a file folder

Select the Generate button

57

Page 58: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Save as HLTAPI for PythonHLTAPI for Python

Select Yes if you wish to view the generated script.

58

Page 59: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Setup HLTAPI Python Execution Environment Install Python in a folder such as C:\Python27.

HLTAPI for Python

Copy the HLTAPI for Python library files, hltapiserver.srv and sth.py (from \SourceCode\hltapiForPython) to your Python library such as C:\Python27\Lib.

Python LibraryC:\Python27\Lib

59

Page 60: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Setup HLTAPI Python Execution Environment Add the C:/Tcl/bin/tclsh (no quotation marks) into the Windows

Environment Variable STC_TCL. HLTAPI Python requires this environment variable.

HLTAPI for Python

60

Page 61: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

Execute HLTAPI Python Script Make sure the test ports available and run HLTAPI for Python script:

python Test_hltapi.py

HLTAPI for Python

61

Page 62: Essentials of Spirent TestCenter GUI to Script Automation · The Essentials of Spirent TestCenter GUI to Script Automation Web-based course is designed to present an overview of the

Spirent Communications

© Spirent Communications, Inc. All of the company names and/or brand names and/or product names and/or logos referred to in this document, in particular the name “Spirent” and its logo device, are either registered trademarks or trademarks pending registration in accordance with relevant national laws. All rights reserved. Specifications subject to change without notice

spirent.com

Thank You

62