Skip to content

Commit

Permalink
Merge pull request #257 from gregbo/patch-1
Browse files Browse the repository at this point in the history
Update ipinterfaces.py
  • Loading branch information
dlyssenko authored May 20, 2023
2 parents 6bfa9ff + 5f13a47 commit fd843d4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pyeapi/api/ipinterfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,22 @@
Parameters:
name (string): The interface name the configuration is in reference
to. The interface name is the full interface identifier
to. The interface name is the full interface identifier.
address (string): The interface IP address in the form of
address/len.
mtu (integer): The interface MTU value. The MTU value accepts
integers in the range of 68 to 65535 bytes
integers in the range of 68 to 65535 bytes. See RFC 791 and
RFC 8200 for more information.
"""

import re

from pyeapi.api import EntityCollection

IP_MTU_MIN = 68
IP_MTU_MAX = 65535

SWITCHPORT_RE = re.compile(r'no switchport$', re.M)

Expand Down Expand Up @@ -222,7 +225,7 @@ def set_mtu(self, name, value=None, default=False, disable=False):
config to
value (integer): The MTU value to set the interface to. Accepted
values include 68 to 65535
values include IP_MTU_MIN (68) to IP_MTU_MAX (65535)
default (bool): Configures the mtu parameter to its default
value using the EOS CLI default command
Expand All @@ -240,7 +243,7 @@ def set_mtu(self, name, value=None, default=False, disable=False):
"""
if value is not None:
value = int(value)
if not 68 <= value <= 65535:
if not IP_MTU_MIN <= value <= IP_MTU_MAX:
raise ValueError('invalid mtu value')

commands = ['interface %s' % name]
Expand Down

0 comments on commit fd843d4

Please sign in to comment.