Use technology neutral "auto" instead of "dhcp" for autoconfiguration (#2241)

* Use technology neutral "auto"  instead of "dhcp" for autoconfiguration

IPv6 is often run with SLAAC which does not use a DHCP server but still
does automatic address configuration. Follow wording of NetworkManager
and use "auto" instead.

* Use "auto" also in interface_update.tmpl

* Update interface_update.tmpl

* remove newline

Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
Stefan Agner 2020-11-11 18:23:04 +01:00 committed by GitHub
parent 5f2d183b1d
commit d558ad2d76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -234,7 +234,7 @@ class APINetwork(CoreSysAttributes):
ipv4_config = None
if ATTR_IPV4 in body:
ipv4_config = IpConfig(
body[ATTR_IPV4].get(ATTR_METHOD, InterfaceMethod.DHCP),
body[ATTR_IPV4].get(ATTR_METHOD, InterfaceMethod.AUTO),
body[ATTR_IPV4].get(ATTR_ADDRESS, []),
body[ATTR_IPV4].get(ATTR_GATEWAY, None),
body[ATTR_IPV4].get(ATTR_NAMESERVERS, []),
@ -243,7 +243,7 @@ class APINetwork(CoreSysAttributes):
ipv6_config = None
if ATTR_IPV6 in body:
ipv6_config = IpConfig(
body[ATTR_IPV6].get(ATTR_METHOD, InterfaceMethod.DHCP),
body[ATTR_IPV6].get(ATTR_METHOD, InterfaceMethod.AUTO),
body[ATTR_IPV6].get(ATTR_ADDRESS, []),
body[ATTR_IPV6].get(ATTR_GATEWAY, None),
body[ATTR_IPV6].get(ATTR_NAMESERVERS, []),

View File

@ -13,7 +13,7 @@
,
'ipv4':
{
{% if interface.ipv4.method == "dhcp" %}
{% if interface.ipv4.method == "auto" %}
'method': <'auto'>
{% elif interface.ipv4.method == "disable" %}
'method': <'disabled'>
@ -36,7 +36,7 @@
,
'ipv6':
{
{% if interface.ipv6.method == "dhcp" %}
{% if interface.ipv6.method == "auto" %}
'method': <'auto'>
{% elif interface.ipv6.method == "disable" %}
'method': <'disabled'>

View File

@ -7,7 +7,7 @@ class InterfaceMethod(str, Enum):
DISABLED = "disabled"
STATIC = "static"
DHCP = "dhcp"
AUTO = "auto"
class InterfaceType(str, Enum):

View File

@ -264,7 +264,7 @@ class Interface:
def _map_nm_method(method: str) -> InterfaceMethod:
"""Map IP interface method."""
mapping = {
NMInterfaceMethod.AUTO: InterfaceMethod.DHCP,
NMInterfaceMethod.AUTO: InterfaceMethod.AUTO,
NMInterfaceMethod.DISABLED: InterfaceMethod.DISABLED,
NMInterfaceMethod.MANUAL: InterfaceMethod.STATIC,
}