ASTF Profile: Run only once?

161 views
Skip to first unread message

c.ti...@gmail.com

unread,
Jun 13, 2018, 4:18:29 AM6/13/18
to TRex Traffic Generator
Hi,

I created a simple ASTF profile that sends a HTTP request from one IP and receives a HTTP reply from another IP.

Essentially:
------------------------------------

# Client Program.
prog_c = ASTFProgram()
prog_c.send(http_req)
prog_c.recv((len(http_res)))

# Server Program.
prog_s = ASTFProgram()
prog_s.recv((len(http_req)))
prog_s.send(http_res)

client_template = ASTFTCPClientTemplate(program=prog_c, ip_gen=ip_gen)
server_template = ASTFTCPServerTemplate(program=prog_s)
template = ASTFTemplate(client_template=client_template,
server_template=server_template)

return ASTFProfile(default_ip_gen=ip_gen, templates=template)

------------------------------------

If I run this profile with `sudo ./t-rex-64 -f /vagrant/astf/http.py -c 1 --ast`, it is sent over and over again (like a continuous stream in stateless mode).

I know that I can set the test duration to x seconds, but I wonder if it's possible to tell TRex to execute the profile exactly once?

What I need is not a continuous execution but a "burst" with one HTTP request and one HTTP reply (+ implicit TCP 3-way-handshake and termination).

(I am aware that I can get the PCAP of a single execution with astf-sim. This PCAP could then be replayed exactly once. However, this looks like a rather hacky solution and would be my last resort - especially because my profile will get more complex later ...)

hanoh haim

unread,
Jun 13, 2018, 7:44:29 AM6/13/18
to c.ti...@gmail.com, TRex Traffic Generator
Yes, have a look into limit directive in the astf manual 

--
You received this message because you are subscribed to the Google Groups "TRex Traffic Generator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trex-tgn+u...@googlegroups.com.
To post to this group, send email to trex...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trex-tgn/8a2f78cd-45cc-41bc-a33b-c64bd2b53b34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Hanoh
Sent from my iPhone

c.ti...@gmail.com

unread,
Jun 13, 2018, 8:40:49 AM6/13/18
to TRex Traffic Generator
Thank you very much, using the limit directive worked like a charm!

For anyone that might stumble upon this question in the future:
The solution was to add the limit directive to the ASTFTCPClientTemplate object:

client_template = ASTFTCPClientTemplate(program=prog_c, ip_gen=ip_gen, limit=1)

The API description can be found at:
https://trex-tgn.cisco.com/trex/doc/cp_astf_docs/api/profile_code.html?highlight=limit#astftcpclienttemplate-class
Reply all
Reply to author
Forward
0 new messages