Network helper functions
Extra mods required: netaddr
-
pyaltt2.network.
generate_netacl
(source, default=[]) Generates IP ACL
Doesn’t work with IPv6
Parameters: - source – string with IP/network or iterable
- default – returns if source is empty
-
pyaltt2.network.
netacl_match
(ip, acl) Check if IP mathches network ACL
Doesn’t work with IPv6
Parameters: - ip – IP address to check
- acl – list of netadd.IPNetwork objects
Returns: True if ACL matches, False if not
-
pyaltt2.network.
parse_host_port
(hp, default_port=0) Parse host/port from string
Doesn’t work with IPv6
Parameters: - hp – host/port string to parse
- default_port – default port if no port is specified (default: 0)
Returns: tuple (host, port)