pygui: revert change to keep references for created interfaces properly
This commit is contained in:
parent
06e3d84862
commit
41df8a57b8
1 changed files with 9 additions and 3 deletions
|
@ -847,7 +847,6 @@ class CoreClient:
|
|||
ip6=ip6,
|
||||
ip6mask=ip6_mask,
|
||||
)
|
||||
canvas_node.interfaces[interface.id] = interface
|
||||
logging.info(
|
||||
"create node(%s) interface(%s) IPv4(%s) IPv6(%s)",
|
||||
node.name,
|
||||
|
@ -873,13 +872,11 @@ class CoreClient:
|
|||
src_interface = None
|
||||
if NodeUtils.is_container_node(src_node.type):
|
||||
src_interface = self.create_interface(canvas_src_node)
|
||||
edge.src_interface = src_interface
|
||||
self.interface_to_edge[(src_node.id, src_interface.id)] = edge.token
|
||||
|
||||
dst_interface = None
|
||||
if NodeUtils.is_container_node(dst_node.type):
|
||||
dst_interface = self.create_interface(canvas_dst_node)
|
||||
edge.dst_interface = dst_interface
|
||||
self.interface_to_edge[(dst_node.id, dst_interface.id)] = edge.token
|
||||
|
||||
link = core_pb2.Link(
|
||||
|
@ -889,6 +886,15 @@ class CoreClient:
|
|||
interface_one=src_interface,
|
||||
interface_two=dst_interface,
|
||||
)
|
||||
# assign after creating link proto, since interfaces are copied
|
||||
if src_interface:
|
||||
interface_one = link.interface_one
|
||||
edge.src_interface = interface_one
|
||||
canvas_src_node.interfaces[interface_one.id] = interface_one
|
||||
if dst_interface:
|
||||
interface_two = link.interface_two
|
||||
edge.dst_interface = interface_two
|
||||
canvas_dst_node.interfaces[interface_two.id] = interface_two
|
||||
edge.set_link(link)
|
||||
self.links[edge.token] = edge
|
||||
logging.info("Add link between %s and %s", src_node.name, dst_node.name)
|
||||
|
|
Loading…
Reference in a new issue