Package: lbr-trex-client
Python package lbr-trex-clientCisco TRex traffic generatoris distributed as a
single.tar.gz archiveand contains all external libraries/packages for running TRex.
This means trying to use or import TRex Client Python API in your code is relatively complicated, especially
if your code runs on different machine than TRex itself.The purpose of this package is to provide client API in form of Python package
which can be easily installed viapip. This API is part of
TRex as anothertar.gz archive.
It was repackaged as standard Python module.
Versions of this package follow TRexversion scheme.
Although module was tested only on Python 3.8, it is likely that newer Python versions will work as well.
Official source code can be also found onTRex GitHub.InstallationYou can use following command for installation:python3.8 -m pip install lbr-trex-clientUsageImportinglbr_trex_clientautomatically sets paths and environment variables
for hassle-free usage of TRex Client API. Imports used in, for example,TRex Cookbookwill then work as well.import lbr_trex_client

from trex.stl.api import *
from trex.astf.api import *
from trex_stl_lib.api import *
from trex_client import CTRexClient
from trex_exceptions import TRexInUseError
from scapy.layers.dns import *
...Alternatively you can usefrom lbr_trex_client.interactive.trex.stl.api import *
from lbr_trex_client.interactive.trex.astf.api import *
...You can notice that imports above also containScapy.
As mentioned, TRex archive contains all dependencies, including modified Scapy.
Exploreexternal_libsto see all external packages.Note thatif your code already imported given package, then TRexwill replaceit with it's
own version of package. Thereplacement methodhowever is not perfect and you can still be left with some local and some TRex version of modules.
This is mostly evident with Scapy, especially withfrom scapy.all import *import.
It can then lead to strange errors.Differences compared to official TRex APIPackagelbr-trex-clienthas few changes compared to official client package:stf/examplesdirectory is removed (examples are not required for API).interactive/profilesdirectory is removed (contains more examples and tests).interactive/trex/examplesdirectory is removed (more examples).interactive/trex/.vscode/tagsfile is removed (unimportant).interactive/trex/wirelessunit tests, examples and Sphinx docs removed.__pycache__and*.pycfiles removed.sys.pathandos.environaremodifiedon module import for hassle-free usage.Known issuesOn import you can get warning messages from Scapy:...lbr_trex_client/external_libs/scapy-2.4.3/scapy/layers/ipsec.py:469: CryptographyDeprecationWarning: Blowfish has been deprecated
  cipher=algorithms.Blowfish,
...lbr_trex_client/external_libs/scapy-2.4.3/scapy/layers/ipsec.py:483: CryptographyDeprecationWarning: CAST5 has been deprecated
  cipher=algorithms.CAST5,This is related to the fact that TRex uses older Scapy version.Links to official TRex documentationHere are links to API reference of main components:Stateless[trex.stl.api]- API for stateless mode.Advanced Stateful[trex.astf.api]- API for advanced stateful mode.trex_client[CTRexClient]- API for communication with TRex daemon.General TRex documentation can be foundhere.Custom TRex APIYou can also uselbr-testsuitepackage for custom TRex API that is built on top of this package.
For more information seetestsuite.Hosting and contributionPackagelbr-trex-clientis hosted publicly on Python Package Index (PyPI)
and internally in GitLab's Package Registry.This project uses GitLab CI pipeline which is triggered
with every new commit. Pipeline creates .whl package from contents
insidelbr_trex_clientfolder.If pipeline triggers onmasterbranch, then package is also uploaded into
GitLab Package Registry. Version of package is defined bygit tags.
Additionally, package is also uploaded on PyPI if it has a tag.Repository MaintainerDominik Tran,tran@cesnet.czLicensePackage is published underApache License Version 2.0, which isinheritedfrom the TRex traffic generator
source. The TRex client API contains also modified version of Scapy library, which is published underGPLv2license.