Customer Service Center
Home
Knowledge Base
Contact Support
License Activation
|
Contact Support
|
License Activation
|
Spirent KB Article
Doc ID: SOL11513
Printer Friendly
Email Article Link
Spirent TestCenter: How to set up Python API environment?
Procedure
After installing the supported Python version, please follow the steps....
Copy the StcPython.py file from
Linux:
/Installdir/Spirent_TestCenter_5.xx/Spirent_TestCenter_Application_Linux/API/Python
Windows:
C:\Program Files (x86)\Spirent Communications\Spirent TestCenter 5.xx\Spirent TestCenter Application\API\python
Edit the File and change the STC_PRIVATE_INSTALL_DIR' to appropriate install dir as shown below
Linux:
os.environ['STC_PRIVATE_INSTALL_DIR'] = "/opt/Spirent_TestCenter_5.xx/Spirent_TestCenter_Application_Linux/"
Windows:
os.environ['STC_PRIVATE_INSTALL_DIR'] = "C:\Program Files (x86)\Spirent Communications\Spirent TestCenter 5.xx\Spirent TestCenter Application"
How to validate the set up: Place the modified StcPython.py file where you execute “Python” script from
Run the Python Shell
Linux
[user@ott245]# python
Python 2.6.7 (r267:88850, Apr 16 2013, 23:56:54)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Windows
C:\MyPython\python
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Import the package
>>> from StcPython import StcPython
Find the loaded TestCenter version
>>> stc = StcPython()
>>> stc.get('system1', 'version')
' 5.21.0606.0000 ‘
>>>
Notes
Need to install the correct bit level python - 2.6.5 up to 3.4.4
Note: We say we support up to 3.6.9 but only up to 3.4.4 will work in 5.14.
Need to know is this the STC 32 or 64 bit app when setting the directory in the StcPython.py script.
C:\Program Files (x86)\Spirent Communications\Spirent TestCenter 5.14\Spirent TestCenter Application\API\Python
or
C:\Program Files\Spirent Communications\Spirent TestCenter 5.14\Spirent TestCenter Application\API\Python
Version
6.0
Publish Date
2021-06-25
Categories
Product : L2-3,Automation,API
Related Articles