system: Network autoconfiguration

Add a czechlight-network:dhcp-client leaf into
ietf-interfaces:interfaces/interface/ietf-ip:ipv4 container which
indicates whether the implementation starts an DHCP client on IPv4.

For IPv6, we use
ietf-interfaces:interfaces/interface/ietf-ip:ipv6/autoconf container.
The value of autoconf/create-global-addresses leaf is mapped to
networkd's IPv6AcceptRA config value [1].

The 'DHCP=' option in systemd.network [2] allows multiple values
managing DHCPv4 and DHCPv6. We chose to ignore DHCPv6 because it will
(or won't) be triggered by router advertisement (RA) *regardless* of
this parameter [2]. It is sufficient to have RA on (which is managed by
the ipv6/autoconf leaf). In case RA is on but no routers are found,
systemd-network starts the DHCP client anyway [1]. If RA is off, then
no IPv6 autoconfiguration happens.

[1] https://systemd.network/systemd.network.html#IPv6AcceptRA=
[2] https://systemd.network/systemd.network.html#DHCP=

Change-Id: Ia885ae644d368987b6101f828bddfd0fc4e969dd
diff --git a/yang/czechlight-network@2021-02-22.yang b/yang/czechlight-network@2021-02-22.yang
index 2d67e8b..7c352aa 100644
--- a/yang/czechlight-network@2021-02-22.yang
+++ b/yang/czechlight-network@2021-02-22.yang
@@ -104,25 +104,32 @@
 		}
 	}
 
+    augment /if:interfaces/if:interface/ip:ipv4 {
+        description "Add the IPv4 autoconfiguration option (DHCP client).";
+
+        leaf dhcp-client {
+            type boolean;
+            default true;
+            description "Enable DHCP client.";
+        }
+    }
+
     deviation /if:interfaces/if:interface/ip:ipv4 {
         deviate add {
-            must 'ip:enabled = "false" or count(ip:address) > 0' {
-                error-message "There must always be at least one IPv4 address unless the protocol is disabled.";
+            must 'ip:enabled = "false" or count(ip:address) > 0 or cla-network:dhcp-client = "true"' {
+                error-message "There must always be at least one IPv4 address or the autoconfiguration must be turned on unless the protocol is disabled.";
             }
         }
     }
 
     deviation /if:interfaces/if:interface/ip:ipv6 {
         deviate add {
-            must 'ip:enabled = "false" or count(ip:address) > 0' {
-                error-message "There must always be at least one IPv6 address unless the protocol is disabled.";
+            must 'ip:enabled = "false" or count(ip:address) > 0 or ip:autoconf/ip:create-global-addresses = "true"' {
+                error-message "There must always be at least one IPv6 address or the autoconfiguration must be turned on unless the protocol is disabled.";
             }
         }
     }
 
-    // IPv6 address autoconfiguration is not supported
-    deviation /if:interfaces/if:interface/ip:ipv6/ip:autoconf { deviate not-supported; }
-
     identity dhcp {
         base rt:routing-protocol;
         description "Identity for route installed by DHCP.";