From 9474a666709e9b21e7cdb1d483b1399139539c50 Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Sat, 7 Dec 2024 11:37:31 -0600 Subject: [PATCH] Wait to assign the new name, else clones may get wrong names --- netsim/extra/node.clone/plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netsim/extra/node.clone/plugin.py b/netsim/extra/node.clone/plugin.py index f15f0b41d..03c7443e1 100644 --- a/netsim/extra/node.clone/plugin.py +++ b/netsim/extra/node.clone/plugin.py @@ -58,8 +58,8 @@ def clone_node(node: Box, topology: Box) -> None: name_format = topology.defaults.clone.node_name_pattern orig_name = node.name - node.name = strings.eval_format(name_format, node + { 'id': 1 } ) # Rename first node as clone_01 - topology.nodes += { node.name: node } + new_name = strings.eval_format(name_format, node + { 'id': 1 } ) # Rename first node as clone_01 + topology.nodes += { new_name: node } clones = [ node.name ] for c in range(_p.start+1,_p.start+_p.count+2,_p.step): # Existing node is '1' @@ -98,6 +98,7 @@ def clone_node(node: Box, topology: Box) -> None: if 'vrfs' in topology: update_links(topology.vrfs,orig_name,clones,topology) + node.name = new_name topology.nodes.pop(orig_name,None) # Finally """