Development

This commit is contained in:
Matthew Grotke 2026-05-27 15:29:23 -04:00
parent e2573fbf12
commit f0504f802e
8 changed files with 67 additions and 66 deletions

View file

@ -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."""