Skip to content

Commit

Permalink
fix: do not allow passing negative interface mtu and/or speed (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoparente authored Dec 24, 2024
1 parent e9059f3 commit 5011879
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions device-discovery/device_discovery/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ def translate_interface(

# Convert napalm interface speed from Mbps to Netbox Kbps
speed = int(interface_info.get("speed")) * 1000
if not int32_overflows(speed):
if speed > 0 and not int32_overflows(speed):
interface.speed = speed

mtu = interface_info.get("mtu")
if not int32_overflows(mtu):
if mtu > 0 and not int32_overflows(mtu):
interface.mtu = mtu

return interface
Expand Down

0 comments on commit 5011879

Please sign in to comment.