Development
This commit is contained in:
parent
e2573fbf12
commit
f0504f802e
8 changed files with 67 additions and 66 deletions
|
|
@ -223,6 +223,14 @@ _DOTTED_TO_PREFIX = {
|
|||
'255.255.255.248': 29, '255.255.255.252': 30,
|
||||
}
|
||||
|
||||
def vlan_id(value):
|
||||
"""VLAN ID integer 1-4094. Returns int or None."""
|
||||
try:
|
||||
n = int(str(value).strip())
|
||||
return n if 1 <= n <= 4094 else None
|
||||
except (ValueError, TypeError):
|
||||
return None
|
||||
|
||||
def subnet_mask(value):
|
||||
"""Subnet prefix length 1-30 (integer). Also accepts legacy dotted notation.
|
||||
Returns int on success, None if invalid."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue