Worth Reading: Lab as Code (containerlab and netlab)
@sjhloco wrote an excellent in-depth description of how you can use containerlab and netlab to manage your labs as code.
He also documented a few netlab shortcomings (one of which caused a crash); fortunately, I found his blog post (admittedly over a year later) and fixed most of them in release 26.04:
- The new bgp.advertise attribute is exactly what he asked for. It’s a list of prefixes to advertise into BGP, and implemented as network statements (Cisco IOS, Arista EOS, FRR…) or as prefix lists for BGP export policies (Junos, SR Linux, SR OS).
- Once I had the bgp.advertise attribute, the next logical step was, “Gee, I could use that with static discard routes to reimplement bgp.originate!” (an old attribute added to netlab before it became dual-stack-aware, and years before it got static routes). Having realized that, it was only a short process to get dual-stack bgp.originate working in global- and VRF BGP instances on platforms where we know how to configure static discard routes. Now you know why so many platforms got static routing support in release 26.04 ;)
- The node bgp.as versus global vrf.as confusion was exactly that, and I updated the documentation to make it (hopefully) a bit more obvious.
- I did forget node router_id attribute, and fixed that omission.
- The bgp.policy plugin borked the module node attribute for hosts. The workaround (if you knew the code) would have been to set module node attribute to
[], but of course, such a FUBAR deserves to be fixed.
It’s great to see someone diving so deep into netlab and documenting its shortcomings. If only there were a mechanism to report them, rather than my random stumbling upon the blog post. Oh, wait ;)
On a more serious note, even dropping me a message with a pointer to that wonderful blog post would be enough to get me started.