def run(FileName):
    try:
        stc = StcPython()
        log_dir = stc.perform('GetSystemPaths').get('SessionDataPath', '')
        stc.perform('SaveEquipmentInfoCommand')
        stc.perform('GetEquipmentLogsCommand',
                    EquipmentList='project1', TimestampFileNames=False)
        stc.perform('SaveToTccCommand',
                    FileName=os.path.join(log_dir, 'config.tcc'))
        _archive(stc, FileName, log_dir)

    except Exception:
        stc.log('ERROR',
                'error: unhandled exception:\n' + traceback.format_exc())
        return False

    return True
Exemplo n.º 2
0
# File Name:                 Anatomy.py
# Description:               This script demonstrates basic features 
#                            such as creating streams, generating traffic,
#                            enabling capture, saving realtime results
#                            to files, and retrieving results.

import sys
import time

ENABLE_CAPTURE = True

# This loads the TestCenter library.
from StcPython import StcPython
stc = StcPython()

stc.log("INFO", "Starting Test")

# This line will show the TestCenter commands on stdout
#stc.config("automationoptions", logto="stdout", loglevel="INFO")

# Retrieve and display the current API version.
print "SpirentTestCenter system version:\t", stc.get("system1", "version")

# Physical topology
szChassisIp1 = "10.29.0.49"
szChassisIp2 = "10.29.0.45"
txPortLoc = "//%s/%s/%s" % ( szChassisIp1, 1, 1)
rxPortLoc = "//%s/%s/%s" % ( szChassisIp2, 1, 1)

# Create the root project object
print "Creating project ..."
import sys
import time

ENABLE_CAPTURE = True

# This loads the TestCenter library. 
# Note that a viable Tcl environment must be available for the library to run
# and that the Python Tkinter package must be installed.
# The version of the TestCenter library that will be loaded will be determined
# by normal Tcl package management. The easiest way to change versions will be
# to set the TCLLIBPATH environment variable to point to the desired version
# just like would be done in a normal Tcl installation.
from StcPython import StcPython
stc = StcPython()

stc.log("INFO", "Starting Test")

# This line will show the TestCenter commands on stdout
#stc.config("automationoptions", logto="stdout", loglevel="INFO")

# Retrieve and display the current API version.
print "SpirentTestCenter system version:\t", stc.get("system1", "version")

# Physical topology
szChassisIp = "192.168.22.253"
iTxSlot = 2
iTxPort = 1
iRxSlot = 2
iRxPort = 2

# Create the root project object