Esempio n. 1
0
 def _validate(self):
     if (len(self._config_servers) > 2
             and any(is_ipv6_address(n) for n in self._config_servers)
             and any(not is_ipv6_address(n) for n in self._config_servers)):
         raise NmstateNotImplementedError(
             "Three or more nameservers are only supported when using "
             "either IPv4 or IPv6 nameservers but not both.")
Esempio n. 2
0
def _set_dynamic(setting_ip, is_dhcp, is_autoconf):
    if not is_dhcp and is_autoconf:
        raise NmstateNotImplementedError(
            "Autoconf without DHCP is not supported yet")

    if is_dhcp and is_autoconf:
        setting_ip.props.method = nmclient.NM.SETTING_IP6_CONFIG_METHOD_AUTO
    elif is_dhcp and not is_autoconf:
        setting_ip.props.method = nmclient.NM.SETTING_IP6_CONFIG_METHOD_DHCP
Esempio n. 3
0
def validate_dns(state):
    """
    Only support at most 2 name servers now:
    https://nmstate.atlassian.net/browse/NMSTATE-220
    """
    dns_servers = (
        state.get(DNS.KEY, {}).get(DNS.CONFIG, {}).get(DNS.SERVER, [])
    )
    if len(dns_servers) > 2:
        raise NmstateNotImplementedError(
            "Nmstate only support at most 2 DNS name servers"
        )
Esempio n. 4
0
def add_routes(setting_ip, routes):
    for route in routes:
        if route[Route.DESTINATION] in (
                IPV4_DEFAULT_GATEWAY_DESTINATION,
                IPV6_DEFAULT_GATEWAY_DESTINATION,
        ):
            if setting_ip.get_gateway():
                raise NmstateNotImplementedError(
                    "Only a single default gateway is supported due to a "
                    "limitation of NetworkManager: "
                    "https://bugzilla.redhat.com/1707396")
            _add_route_gateway(setting_ip, route)
        else:
            _add_specfic_route(setting_ip, route)
Esempio n. 5
0
def validate_dns(state):
    """
    Only support at most 2 name servers now:
    https://nmstate.atlassian.net/browse/NMSTATE-220
    """
    dns_servers = (
        state.get(DNS.KEY, {}).get(DNS.CONFIG, {}).get(DNS.SERVER, [])
    )
    if len(dns_servers) > 3:
        logging.warning(
            "The libc resolver may not support more than 3 nameservers."
        )
    if (
        len(dns_servers) > 2
        and any(is_ipv6_address(n) for n in dns_servers)
        and any(not is_ipv6_address(n) for n in dns_servers)
    ):
        raise NmstateNotImplementedError(
            "Three or more nameservers are only supported when using "
            "either IPv4 or IPv6 nameservers but not both."
        )
Esempio n. 6
0
 def absent(self):
     raise NmstateNotImplementedError(
         "RouteRuleEntry does not support absent property"
     )