Ways to start Trex stateless server

486 views
Skip to first unread message

asilv...@gmail.com

unread,
Jan 6, 2021, 11:30:26 PM1/6/21
to TRex Traffic Generator
Hi,
  I've been successfully been using Trex in stateless mode for over a year now.  However, each time I want to run a test, I have to manually start the stateless server using the following the command:
sudo ./t-rex-64 -i -c 14 
I want to eliminate this manual step and have the server started in the background or some type of daemon so it is "always" running on the server.  Or since I'm I've built some python scripts to run these stateless tests, maybe have the Python API start the server?? Is this possible?  If it is, I couldn't easily find the procedures in the documentation.
Thx
Al

hanoh haim

unread,
Jan 7, 2021, 3:21:45 AM1/7/21
to asilv...@gmail.com, TRex Traffic Generator
Hi Al,
Because there are a few modes of operation in our regression tests we are using the daemon API to start the server in specific mode. 
So you script should be 

1) start in server linux startup the trex_daemon
2) trex_daemon.start_stl_mode()
3) stl_client.connect()  # your normal script 

see this for trex_daemon API

You can look into our regression code for examples (part of the trex-core github)

Thanks
Hanoh

asilv...@gmail.com

unread,
Jan 9, 2021, 6:34:04 PM1/9/21
to TRex Traffic Generator
Hello Hanoch,
 This is exactly how I normally start the server in interactive mode:
cd /opt/trex/v2.73/trex-core/scripts
sudo ./t-rex-64 -i -c 14

Looking at the link to the documentation you sent, I think the command trex_daemon_server makes sense for me... But I have a few questions:

Does this executable only start the daemon in "stateful" mode or can I also use this to start in "stateless" mode?

When running the help for this command, I don't see an option to specify the number of cores I need.  How can I achieve that  while still using the trex_daemon_server command?

```
[asilver@trex scripts]$ sudo ./trex_daemon_server -h
[sudo] password for asilver:
usage: trex_daemon_server [-h] [-v] [-p PORT] [-z PORT] [-t PATH] [-f PATH]
                          [--trex-host HOST] [-n NICE]
                          {start,stop,start-live,restart,show}

Run server application for TRex traffic generator

positional arguments:
  {start,stop,start-live,restart,show}
                        Specify action command to be applied on server.
                            (*) start      : start the application in as a daemon process.
                            (*) show       : prompt an updated status of daemon process (running/ not running).
                            (*) stop       : exit the daemon process.
                            (*) restart    : stop, then start again the application as daemon process
                            (*) start-live : start the application in live mode (no daemon process).


optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -p PORT, --daemon-port PORT
                        Select port on which the daemon runs.
                        Default port is 8090.
  -z PORT, --zmq-port PORT
                        default TRex ZMQ publisher port to listen to (if not specified in config file).
                        Default port is 4500.
  -t PATH, --trex-path PATH
                        Specify the compiled TRex directory from which TRex would run.
                        Default path is: /opt/trex/v2.73/trex-core/scripts.
  -f PATH, --files-path PATH
                        Specify a path to directory on which pushed files will be saved at.
                        Default path is: /tmp/trex_files.
  --trex-host HOST      Specify a hostname to be registered as the TRex server.
                        Default is to bind all IPs using '0.0.0.0'.
  -n NICE, --nice NICE  Determine the priority TRex process [-20, 19] (lower = higher priority)
                        Default is -19.
[asilver@trex scripts]$
```

I could not find where this is documented trex_daemon.start_stl_mode()  if I have to go this route... How to set number of cores this way.. etc..

Thx
Al

hanoh haim

unread,
Jan 11, 2021, 4:42:05 AM1/11/21
to asilv...@gmail.com, TRex Traffic Generator
Hi Al,
The number of cores and the mode (STL,ASTF,STF) is part of the API not the daemon. The daemon gives you the possibility to run any more with any command line options. 
It gives a way to kill trex too. 

Explore the API 

Thanks
Hanoh
Reply all
Reply to author
Forward
0 new messages