From 42c85d23b7720268914f2699b0757faf4ee2fd08 Mon Sep 17 00:00:00 2001 From: J vanBemmel Date: Sat, 5 Oct 2024 08:12:25 -0500 Subject: [PATCH] Fix Cumulus container management IPv4 prefix (#1341) --- netsim/providers/__init__.py | 4 +++- netsim/templates/provider/clab/cumulus/interfaces.j2 | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/netsim/providers/__init__.py b/netsim/providers/__init__.py index d631239a1..ec26d2f60 100644 --- a/netsim/providers/__init__.py +++ b/netsim/providers/__init__.py @@ -163,7 +163,9 @@ def create_extra_files( file_name = file.replace(out_folder+"/","") template_name = self.find_extra_template(node,file_name,topology) if template_name: - node_data = node + { 'hostvars': topology.nodes, 'hosts': get_host_addresses(topology) } + node_data = node + { 'hostvars': topology.nodes, + 'hosts': get_host_addresses(topology), + 'addressing': topology.addressing } # Needed for subnet prefix if '/' in file_name: # Create subdirectory in out_folder if needed pathlib.Path(f"{out_folder}/{os.path.dirname(file_name)}").mkdir(parents=True,exist_ok=True) try: diff --git a/netsim/templates/provider/clab/cumulus/interfaces.j2 b/netsim/templates/provider/clab/cumulus/interfaces.j2 index 1688541b3..d4087f309 100644 --- a/netsim/templates/provider/clab/cumulus/interfaces.j2 +++ b/netsim/templates/provider/clab/cumulus/interfaces.j2 @@ -7,7 +7,7 @@ iface mgmt auto eth0 iface eth0 inet static - address {{ mgmt.ipv4 }} + address {{ mgmt.ipv4 }}/{{ addressing.mgmt.prefix }} vrf mgmt source /etc/network/interfaces.d/*.intf