fix to avoid setting interface data for a mac to the string None, when not present

This commit is contained in:
Blake Harnden 2020-07-16 08:59:57 -07:00
parent d1fd19edc6
commit 1212e5ddf8
2 changed files with 6 additions and 3 deletions

View file

@ -1050,8 +1050,9 @@ class CoreNetworkBase(NodeBase):
if uni: if uni:
unidirectional = 1 unidirectional = 1
mac = str(iface.mac) if iface.mac else None
iface2_data = InterfaceData( iface2_data = InterfaceData(
id=linked_node.get_iface_id(iface), name=iface.name, mac=str(iface.mac) id=linked_node.get_iface_id(iface), name=iface.name, mac=mac
) )
ip4 = iface.get_ip4() ip4 = iface.get_ip4()
if ip4: if ip4:

View file

@ -875,8 +875,9 @@ class PtpNet(CoreNetwork):
if iface1.getparams() != iface2.getparams(): if iface1.getparams() != iface2.getparams():
unidirectional = 1 unidirectional = 1
mac = str(iface1.mac) if iface1.mac else None
iface1_data = InterfaceData( iface1_data = InterfaceData(
id=iface1.node.get_iface_id(iface1), name=iface1.name, mac=str(iface1.mac) id=iface1.node.get_iface_id(iface1), name=iface1.name, mac=mac
) )
ip4 = iface1.get_ip4() ip4 = iface1.get_ip4()
if ip4: if ip4:
@ -887,8 +888,9 @@ class PtpNet(CoreNetwork):
iface1_data.ip6 = str(ip6.ip) iface1_data.ip6 = str(ip6.ip)
iface1_data.ip6_mask = ip6.prefixlen iface1_data.ip6_mask = ip6.prefixlen
mac = str(iface2.mac) if iface2.mac else None
iface2_data = InterfaceData( iface2_data = InterfaceData(
id=iface2.node.get_iface_id(iface2), name=iface2.name, mac=str(iface2.mac) id=iface2.node.get_iface_id(iface2), name=iface2.name, mac=mac
) )
ip4 = iface2.get_ip4() ip4 = iface2.get_ip4()
if ip4: if ip4: