Skip to content

Commit

Permalink
Wait to assign the new name, else clones may get wrong names
Browse files Browse the repository at this point in the history
  • Loading branch information
jbemmel committed Dec 7, 2024
1 parent 715fd67 commit 9474a66
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions netsim/extra/node.clone/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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

"""
Expand Down

0 comments on commit 9474a66

Please sign in to comment.