how to create a scales version of VLANS endpoints on the TREX

96 views
Skip to first unread message

kamal.p...@terralogic.com

unread,
Mar 20, 2017, 3:44:08 AM3/20/17
to TRex Traffic Generator
Hi,

 Could someone let me know on how to create 2000 vlan endpoints per port in TREX.

 This is my current TREX-cfg file

- port_limit: 2
  version: 2
  interfaces: ['07:00.0','07:00.1']
  port_info:
      - default_gw: 11.1.0.251
        ip        : 11.1.0.2
      - default_gw: 11.2.0.251
        ip        : 11.2.0.2

As per this config I could generate only one vlan endpoint per port.

My requirement is the client(TREX)  must be directly connected directly to the access port (switch) .

So here I need to have the TREX actin as a switch instead of router.

Let me know if there is any way to suffice this scenario .

Regards,
Kamal

Andreas Bourges

unread,
Mar 20, 2017, 4:31:53 AM3/20/17
to TRex Traffic Generator
Hi Kamal,

...I'm doing something similar here. I think the best (only?) way to achieve this is building
the packets with scapy using the API. This works very well for me, but needs a little bit more
effort in the beginning.

regards,

Andreas

kamal.p...@terralogic.com

unread,
Mar 20, 2017, 6:11:03 AM3/20/17
to TRex Traffic Generator
Thanks Andreas.

Could you share any pointer/snip on how the scapy packet would look like ?

Regards,
Kamal

Andreas Bourges

unread,
Mar 20, 2017, 6:35:05 AM3/20/17
to TRex Traffic Generator
Hi,

...for a starter please see

https://groups.google.com/forum/m/#!topic/trex-tgn/DbkJIOZND3A

The script puts the ports into service-mode for capturing packets and performing ARP resolution for a specific vlan (here you can see how scapy is used).
With the ARP response, you get the mac of the default-gw (and btw - the default gw knows your mac in case traffic has to be delivered to the src ip
from another stream). So you would have to use the ARP procedure on either end of the stream (both trex ports used for a stream) during your test-
initialization. After the ARPs have been performed, you could proceed to the stream generation.

To perform the actual stream-tests you would need to generate a packet (similar to the ARP packet, but with the mac of the default gw and
the proper destination ip address) and generate a TRex stream. There a examples in the documentation (stateless doc), but if you need further
information I can provide this to you tomorrow (today I'm very busy).

BTW - this can only be used in stateless mode, as far as I understand.

regards,

Andreas

kamal.p...@terralogic.com

unread,
Mar 21, 2017, 7:12:20 AM3/21/17
to TRex Traffic Generator
Hi Andreas,

    Thanks for the pointer. Could you share the details about your trex_cfg file and a snip of the Scapy packet.

Regards,
Kamal

Andreas Bourges

unread,
Mar 21, 2017, 10:42:48 AM3/21/17
to TRex Traffic Generator
Hi Kamal,

> Thanks for the pointer. Could you share the details about your trex_cfg file and a snip of the Scapy packet.


...my TRex config file looks pretty simple (see at the end of my post) - but the only relevant information in there is the port
configuration. The ip address config is not used in my tests, since I'm using many VLANs, each having a different default GW. I
implemented ARP resolution as seen in the other post and use the gw-MAC address when crafting packets with scapy.

In the link I pasted in the last post you could see how to move TRex ports into service mode and capture the ARP response
from the default gw. Using that information you can now craft your own packets like this in your automation script:

#
# simple base pkt using a single dot1q tag
#
base_pkt = Ether(dst=default_gw_mac_from_arp)/Dot1Q(vlan=src_vlan)/IP(flags="DF", src=src_ip,dst=dst_ip)/UDP(dport=dst_port,sport=src_port)

#
# as seen in the tutorial - expand the packet to the desired size
#
pad = max(0, self.pktLen - len(base_pkt)) * 'x'
finalPkt = base_pkt/pad


Once the packet is built, you can add a stream. Perform the packet building
for each of your clients using differnet IPs/GW Macs ... and add each of them.

#
# c is the client connection as shown in the other script
# see API manual for details or other stream-building options
#
c.add_streams( STLStream( isg = 1000000, name=description,
packet = STLPktBuilder(pkt = finalPkt),
flow_stats = STLFlowStats(pg_id = self.id),
mode = STLTXCont( pps = pps)),
self.port)


#
# start the streams
#
c.start(ports=[0,1], duration = duration, force=True)


...now observe the traffic in tui or add statistics-gathering to your automation script
via c.get_stats( [0,1]).

#
# finally stop streams
#
c.stop([0,1])


Sorry - I can't post the full automation script, since it has quite a few dependencies in the meantime ;-) But I hope you get
the point when looking at the above code-snipplets. You may want to have a look at the TRex stateless client API for further
details or the other examples in the stateless manual.

regards,

Andreas

### Config file generated by dpdk_setup_ports.py ###

- port_limit: 2
version: 2

interfaces: ['01:00.0', '01:00.1']
port_info:
- ip: 1.1.1.1
default_gw: 2.2.2.2
- ip: 2.2.2.2
default_gw: 1.1.1.1

platform:
master_thread_id: 0
latency_thread_id: 10
dual_if:
- socket: 0
threads: [1,2,3,4,5,6,7,8,9,20,21,22,23,24,25,26,27,28,29]

BUT - the configured ip addresses are not used during the tests

Reply all
Reply to author
Forward
0 new messages