nrx icon indicating copy to clipboard operation
nrx copied to clipboard

Containerlab topology endpoint links don't match Netbox data

Open amlicht89 opened this issue 6 months ago • 2 comments

Hello,

I have a device in Netbox that looks like this:

Image

When I render the ContainerLab topology, I get this:

Image

The script looks like its aware of these interfaces

Image

However, it seems like the default.j2 interface_name template is just incrementing the interface name based on an index in a list, which doesn't seem like its actually using the data its getting from netbox to generate this section. Is there something I'm doing incorrectly here? Thanks in advance!

Image

amlicht89 avatar Aug 11 '25 21:08 amlicht89

In the default.j2 interface_names template, replacing {{ index+1 }} with {{ interface }} seems to fix this. Looking more at the codebase, this is probably by design. Perhaps creating and referencing a non-default template specifically for ceos with that variable could be a possible solution.

created ceos.j2 Image

Produces the following: Image

Thank you for maintaining this project, this is incredibly useful in NetDevOps pipelines when using Netbox and ContainerLab

amlicht89 avatar Aug 12 '25 16:08 amlicht89

Hi @amlicht89 , sorry for the delayed response. Currently, nrx relies on ceos interface mapping feature described here: https://containerlab.dev/manual/kinds/ceos/#user-defined-interface-mapping, instead of using the real interface names from netbox. There is an alternative method of naming interfaces that was not available before, this one: https://containerlab.dev/manual/kinds/ceos/#additional-interface-naming-considerations, but it is a bit more complicated due to special handling of / separator. Could you check if mapping would work for you? In general, it works out of the box

bortok avatar Nov 05 '25 01:11 bortok