for gw_ip in gateway_ips:
# TODO(Carl) This is repeated everywhere. A method would
# be nice.
- default_gw = (n_consts.IPv4_ANY if
- netaddr.IPAddress(gw_ip).version == 4 else
- n_consts.IPv6_ANY)
+ default_gw = n_consts.IP_ANY[netaddr.IPAddress(gw_ip).version]
instance = self._get_keepalived_instance()
default_gw_rts.append(keepalived.KeepalivedVirtualRoute(
default_gw, gw_ip, interface_name))
class IpRuleCommand(IpCommandBase):
COMMAND = 'rule'
- ALL = {4: constants.IPv4_ANY, 6: constants.IPv6_ANY}
-
def _parse_line(self, ip_version, line):
# Typical rules from 'ip rule show':
# 4030201: from 1.2.3.4/24 lookup 10203040
# Canonicalize some arguments
if settings.get('from') == "all":
- settings['from'] = self.ALL[ip_version]
+ settings['from'] = constants.IP_ANY[ip_version]
if 'lookup' in settings:
settings['table'] = settings.pop('lookup')