Essentials of Spirent Testcenter GUI to Script Automation
Total Page:16
File Type:pdf, Size:1020Kb
Essentials of Spirent TestCenter GUI to Script Automation Introduction 1 Introduction 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. Spirent Communications 2 Introduction 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. Spirent Communications 3 Course Topics Overview Spirent TestCenter GUI to Script Automation Overview GUI to Script Content Additional Processing Options HLTAPI Spirent Communications 4 Essentials of Spirent TestCenter GUI to Script Automation GUI to Script Automation Overview 5 Course Topics Overview Spirent TestCenter GUI to Script Automation Overview GUI to Script Content Additional Processing Options HLTAPI Spirent Communications 6 Spirent TestCenter GUI to Script Automation Overview GUI to Script 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. Spirent Communications 7 Spirent TestCenter GUI to Script Automation Overview GUI to Script Benefits 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. Spirent Communications 8 Spirent TestCenter GUI to Script Automation Overview GUI to Script Limitations Hard coded scripts. Must use the Command Sequencer in the GUI in order to have a complete Spirent TestCenter automated test. Spirent Communications 9 Spirent TestCenter GUI to Script Automation Overview Spirent TestCenter Test Configuration Spirent Communications 10 Spirent TestCenter GUI to Script Automation Overview Test Configuration Script Generation Spirent Communications 11 Spirent TestCenter GUI to Script Automation Overview Additional Automation Processing Options* Spirent Communications 12 Spirent TestCenter GUI to Script Automation Overview Naming the Scripts Spirent Communications 13 Spirent TestCenter GUI to Script Automation Overview Generated Files 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*. Spirent Communications 14 Spirent TestCenter GUI to Script Automation Overview 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). 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 Spirent Communications 15 Spirent TestCenter GUI to Script Automation Overview Script Results Spirent Communications 16 Essentials of Spirent TestCenter GUI to Script Automation GUI to Script Content 17 Course Topics Overview Spirent TestCenter GUI to Script Automation Overview GUI to Script Content Additional Processing Options HLTAPI Spirent Communications 18 GUI to Script Contents GUI to Script Generated Files Save As Script Menu item generates: <Name>.tcl/pl/rb (Launcher file) <Name>_logic.tcl/pl/rb (Logic file) <Name>.xml (Configuration file)*. Spirent Communications 19 GUI to Script Contents 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 Spirent Communications 20 GUI to Script Contents 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. Spirent Communications 21 GUI to Script Contents 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 Spirent Communications 22 Essentials of Spirent TestCenter GUI to Script Automation Additional Processing Options 23 Course Topics Overview Spirent TestCenter GUI to Script Automation Overview GUI to Script Content Additional Processing Options HLTAPI Spirent Communications 24 Additional Processing Options Additional Automation Processing Options* Spirent Communications 25 Additional Processing Options Script to Run Before Disconnect Populating the Script to Run Before Disconnect will: Run the stated script before the disconnecting from the Spirent TestCenter chassis. Use these scripts to perform actions such as checking device status. Spirent Communications 26 Additional Processing Options Prefix Procedures Populating the Prefix Procedures with will: 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. Spirent Communications 27 Additional Processing Options Encapsulate Procedures Populating the Encapsulate Procedures in Namespace will: Encapsulate all procedures within the Logic script. Add stated namespace to the Launcher script. Spirent Communications 28 Additional Processing Options Do Not Save Default Values Unchecking the Do Not Save Default Values will: Present all Objects within the Logic script. Doubles the size of the Logic Script. Spirent Communications 29 Additional Processing Options Use Default Values for Rarely Modified Settings Checking the Use Default Values for Rarely Modified Settings will: Further reduce the size of the Logic Script. Spirent Communications 30 Additional Processing Options Save the Configuration Data in XML File Using the Save the Configuration Data in Separate XML File will: Create an XML File that contains the test configuration data. Allows XML File to populate GUI. Spirent Communications 31 Additional Processing Options Create Custom Launcher Script If you use Create Custom Launcher Script you must: Retrieve parameters using the following Tcl call: $stc::scriptParameters(-varName) Spirent Communications 32 Additional Processing Options File Path Substitutions Using Create basePathMap Variable with the Following Replacements will: Allow you to create a Replace/With Table that is inserted into Launcher Script. Spirent Communications 33 Essentials of Spirent TestCenter GUI to Script Automation HLTAPI 34 Course Topics Overview Spirent TestCenter GUI to Script Automation Overview GUI to Script Content Additional Processing Options HLTAPI Spirent Communications 35 HLTAPI 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. Spirent Communications 36 Install Spirent TestCenter HLTAPI Download Spirent TestCenter HLTAPI Download the Spirent TestCenter HLTAPI from support.spirent.com Spirent Communications 37 Install Spirent TestCenter HLTAPI Unzip HLTAPI Unzip the downloaded HLTAPI package to a folder (such as C:/HLTAPI_4.52_GA). Spirent Communications 38 Install Spirent TestCenter HLTAPI Modify TCLLIBPATH Add the “C:/HLTAPI_4.52_GA/SourceCode” into the Windows Environment Variable TCLLIBPATH. Spirent Communications 39 Install Spirent TestCenter HLTAPI Verify Installation Launch a Tcl shell and type “package require SpirentHltApi”. The version information indicates that you have successfully installed HLTAPI. Spirent Communications 40 Install Spirent TestCenter HLTAPI Register HLTAPI in Spirent TestCenter To register the Save as HLTAPI tool in Spirent TestCenter: