Is TRex/Bird supporting BGP with BFD

508 views
Skip to first unread message

Haklat Haklat

unread,
Apr 21, 2022, 4:46:31 AM4/21/22
to TRex Traffic Generator
Hi,
I have been asked for DPDK test application that can run BGP with BFD. I know TRex can run with BGP, but is BFD also part of the Bird implementation in TRex?

If it is are there some examples available?

BR//Håkan

Besart Dollma

unread,
Apr 21, 2022, 5:45:41 AM4/21/22
to TRex Traffic Generator
Hi Hakan,
TRex uses the Bird daemon as provided by the Bird team and simply adds a wrapper for it. 
According to the Bird doc, basic BFD is supported. https://bird.network.cz/?get_doc&v=20&f=bird-6.html#ss6.2
This works by sending a configuration file, and TRex is not limiting in this term, it will forward the configuration to the bird daemon.
I don't think we tested this, but I think it will work. 
Thanks, 

Haklat Haklat

unread,
Apr 21, 2022, 8:22:16 AM4/21/22
to TRex Traffic Generator
OK,
thanks then I will maybe try it out. I know it should be supported by bird but this does not always mean it is in the compile used. I did similar thing with other open source router FRR before, then bfd support was not part of standard e.g. ubuntu FRR package. I had to set some compilation flags and compile it in myself. Will let you know if I get it working.

//Håkan

Haklat Haklat

unread,
Apr 26, 2022, 3:42:19 AM4/26/22
to TRex Traffic Generator
Hi,
using v2.92 I managed to start BFD and BGP processes with something like below python API code, starting from the template python API BGP example.
Did not yet have a SUT to test with but looks like you suggested that it can work.

What would be the service filtered mode mask to use, sending traffic and having BGP and BFD passing through. Think BFD use UDP port 3784 (control), UDP port 3785 (echo) and UDP port 4784 (multi hop control - if I would use that).
Below example I use for SUT to be able to resolve ARP. What would be the mask that would fit the BGP/BFD/ARP case?
c.set_service_mode(ports = [0,1], enabled = False, filtered = True, mask = 1)

///Thanks Håkan

import stl_path
from trex.stl.api import *
from trex.pybird.bird_cfg_creator import *
from trex.pybird.pybird_zmq_client import *

"""
Topology::
                                           +-------------------------------+
                                           |                               |
                                           |   TRex         bird namespace |
                                           |        (veth) +---------------+
+------------+                (PHY PORT 0) |  172.80.29.11 |               |
|            |  172.80.29.12  172.80.29.42 |      <--------+               |
|            | <------------><------------>+               |               |
|            |                             |               | Bird Processes|
|    DUT     |                             |        (veth) |   eBGP/BFD    |
|            |  172.80.59.12  172.80.59.42 |  172.80.59.11 |               |
|            | <------------><------------>+      <--------+               |
|            |                (PHY PORT 1) |               |               |
+------------+                             |               +---------------+
                                           |                               |
                                           +-------------------------------+
Link to Python API - Bird Node: https://trex-tgn.cisco.com/trex/doc/cp_stl_docs/api/bird_node.html
"""

c = STLClient(verbose_level = 'debug')
my_ports = [0, 1]
c.connect()
c.acquire(ports = my_ports)
c.set_service_mode(ports = my_ports, enabled = True)
pybird_c = PyBirdClient(ip='localhost', port=4509)
pybird_c.connect()
pybird_c.acquire(force = True)

bird_cfg = BirdCFGCreator()
bgp_data1 = """
    local 172.80.29.11 as 65000;
    neighbor 172.80.29.12 as 65001;
    ipv4 {
            import all;
            export all;
    };
"""
bgp_data2 = """
    local 172.80.59.11 as 65000;
    neighbor 172.80.59.12 as 65001;
    ipv4 {
            import all;
            export all;
    };
"""
bfd_data1 = """
    interface "bird*" {
            min rx interval 300 ms;
            min tx interval 300 ms;
            idle tx interval 300 ms;
            multiplier 3;
    };

    neighbor 172.80.29.12;
    neighbor 172.80.59.12;
"""

bird_cfg.add_protocol(protocol = "bfd", name = "my_bfd1", data = bfd_data1)
bird_cfg.add_protocol(protocol = "bgp", name = "my_bgp1", data = bgp_data1)
bird_cfg.add_protocol(protocol = "bgp", name = "my_bgp2", data = bgp_data2)
bird_cfg.add_route(dst_cidr = "10.10.10.0/24", next_hop = "172.80.29.11")
bird_cfg.add_route(dst_cidr = "10.10.20.0/24", next_hop = "172.80.59.11")
pybird_c.set_config(new_cfg = bird_cfg.build_config())  # sending our new config

# create 2 veth's in bird namespace
c.set_bird_node(node_port      = 0,
                mac            = "00:50:56:18:03:09",
                ipv4           = "172.80.29.11",
                ipv4_subnet    = 24,
                ipv6_enabled   = True,
                ipv6           = "fdbc:c4bd:4135:c7c4:0:0:0:0",
                ipv6_subnet    = 124

c.set_bird_node(node_port      = 1,
                mac            = "00:50:56:19:03:09",
                ipv4           = "172.80.59.11",
                ipv4_subnet    = 24,
                ipv6_enabled   = True,
                ipv6           = "fdbc:c4bd:4135:c7c4:0:0:0:1",
                ipv6_subnet    = 124
                )

pybird_c.check_protocols_up(['my_bgp1, my_bgp2'])
node_1 = c.set_namespace(0, method='get_nodes_info', macs_list=["00:50:56:18:03:09"])
print(node_1)
node_2 = c.set_namespace(1, method='get_nodes_info', macs_list=["00:50:56:19:03:09"])
print(node_2)
pybird_c.release()
pybird_c.disconnect()
c.disconnect()

Besart Dollma

unread,
Apr 28, 2022, 2:20:49 AM4/28/22
to TRex Traffic Generator
Hi,
It seems like you need to use service mode all.
Is it working with your configuration, not sure I got it?
Thanks,

Haklat Haklat

unread,
May 2, 2022, 8:36:23 AM5/2/22
to TRex Traffic Generator
Hi,
what I mean is it looks like it can work as you suggested. I did not yet have any BGP/BFD peer to connect to, but bird protocols (BGP/BFD) were starting up OK.

Does service mode all mean I have filtered mode with all traffic masked to bird namespace (mask=255), e.g.:
c.set_service_mode(ports = [0,1], enabled = False, filtered = True, mask = 255)

and in that case does it have different effect than:

c.set_service_mode(ports = [0,1], enabled = True)

Thanks//Håkan

Besart Dollma

unread,
May 15, 2022, 2:19:21 AM5/15/22
to TRex Traffic Generator
Hi Hakan,
Sorry for the late reply.
There are 3 possible states for the service mode:
1. Enabled - All the packets will be redirected to RX core. 
2. Filtered - Only the packets whose filter you have turned on (for example BGP) will be redirected to RX.
3. Off - No packets will be redirected to Rx.

Since BFD uses UDP with port 3784 (this being different from the BGP port), you will need the first option.
Thanks, 
Reply all
Reply to author
Forward
0 new messages