Add linux.network.systemd support
diff --git a/.kitchen.vagrant.yml b/.kitchen.vagrant.yml
new file mode 100644
index 0000000..fb9981e
--- /dev/null
+++ b/.kitchen.vagrant.yml
@@ -0,0 +1,36 @@
+---
+driver:
+  name: vagrant
+  vm_hostname: linux.ci.local
+  use_sudo: false
+  customize:
+    memory: 1024
+
+
+provisioner:
+  name: salt_solo
+  salt_install: bootstrap
+  salt_bootstrap_url: https://bootstrap.saltstack.com
+  salt_version: latest
+  require_chef: false
+  log_level: error
+  formula: linux
+  grains:
+    noservices: true
+  state_top:
+    base:
+      "*":
+        - linux
+  pillars:
+    top.sls:
+      base:
+        "*":
+          - linux
+
+platforms:
+- name: ubuntu-16.04
+- name: ubuntu-14.04
+- name: centos-7.3
+- name: centos-6.8
+
+# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/README.rst b/README.rst
index 6170e0b..209a799 100644
--- a/README.rst
+++ b/README.rst
@@ -906,6 +906,36 @@
                reject:
                  - 192.33.137.211
 
+Linux network systemd settings:
+
+.. code-block:: yaml
+
+    linux:
+      network:
+        ...
+        systemd:
+          link:
+            10-iface-dmz:
+              Match:
+                MACAddress: c8:5b:67:fa:1a:af
+                OriginalName: eth0
+              Link:
+                Name: dmz0
+          netdev:
+            20-bridge-dmz:
+              match:
+                name: dmz0
+              network:
+                mescription: bridge
+                bridge: br-dmz0
+          network:
+          # works with lowercase, keys are by default capitalized
+            40-dhcp:
+              match:
+                name: '*'
+              network:
+                DHCP: yes
+
 
 Configure global environment variables
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/linux/files/systemd-network.conf b/linux/files/systemd-network.conf
new file mode 100644
index 0000000..6a21b4f
--- /dev/null
+++ b/linux/files/systemd-network.conf
@@ -0,0 +1,8 @@
+{%- from "linux/map.jinja" import system with context -%}
+{%- for section, options in settings.iteritems() %}
+
+[{{ section[0].upper() + section[1:] }}]
+{%- for option, value in options.iteritems() %}
+{{ option[0].upper() + option[1:] }}={{ value }}
+{%- endfor %}
+{%- endfor %}
diff --git a/linux/map.jinja b/linux/map.jinja
index 5e865fb..b8ae8b0 100644
--- a/linux/map.jinja
+++ b/linux/map.jinja
@@ -100,6 +100,7 @@
         'ovs_pkgs': ['openvswitch-switch'],
         'hostname_file': '/etc/hostname',
         'network_manager': False,
+        'systemd': {},
         'interface': {},
         'interface_params': interface_params,
         'bridge': 'none',
@@ -115,6 +116,7 @@
         'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'],
         'dpdk_pkgs': ['dpdk', 'dpdk-dev', 'dpdk-dkms', 'dpdk-igb-uio-dkms', 'dpdk-rte-kni-dkms'],
         'network_manager': False,
+        'systemd': {},
         'interface': {},
         'interface_params': interface_params,
         'bridge': 'none',
@@ -129,6 +131,7 @@
         'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'],
         'hostname_file': '/etc/sysconfig/network',
         'network_manager': False,
+        'systemd': {},
         'interface': {},
         'interface_params': interface_params,
         'bridge': 'none',
diff --git a/linux/network/init.sls b/linux/network/init.sls
index 21069d3..56b05a5 100644
--- a/linux/network/init.sls
+++ b/linux/network/init.sls
@@ -13,6 +13,9 @@
 {%- if network.dhclient is defined %}
 - linux.network.dhclient
 {%- endif %}
+{%- if network.systemd|length > 0 %}
+- linux.network.systemd
+{%- endif %}
 {%- if network.interface|length > 0 %}
 - linux.network.interface
 {%- endif %}
diff --git a/linux/network/systemd.sls b/linux/network/systemd.sls
new file mode 100644
index 0000000..a8e1f24
--- /dev/null
+++ b/linux/network/systemd.sls
@@ -0,0 +1,43 @@
+{%- from "linux/map.jinja" import network with context %}
+{%- if network.enabled and grains.get('init', None) == 'systemd' %}
+
+{%- if network.systemd is mapping %}
+{%- for config_type, configs in network.systemd.iteritems() %}
+
+{%- if config_type == 'link' %}
+/etc/udev/rules.d/80-net-setup-link.rules:
+  file.managed:
+    - makedirs: True
+    - content: ""
+{%- endif %}
+
+{%- for config_name, config in configs.iteritems() %}
+linux_network_systemd_networkd_{{ config_type }}_config_{{ config_name }}:
+  file.managed:
+    - name: /etc/systemd/network/{{ config_name }}.{{ config_type }}
+    - source: salt://linux/files/systemd-network.conf
+    - template: jinja
+    - makedirs: True
+    - defaults:
+        settings: {{ config }}
+    - watch_in:
+      - module: linux_network_systemd_reload
+      - module: linux_network_systemd_networkd
+{%- endfor %}
+{%- endfor %}
+
+linux_network_systemd_reload:
+  module.wait:
+  - name: service.systemctl_reload
+
+linux_network_systemd_networkd:
+  service.running:
+  - name: systemd-networkd
+  - init_delay: 10
+  - enable: True
+  - reload: True
+  - watch:
+    - module: linux_network_systemd_reload
+
+{%- endif %}
+{%- endif %}
diff --git a/tests/pillar/network.sls b/tests/pillar/network.sls
index 009228f..840fd84 100644
--- a/tests/pillar/network.sls
+++ b/tests/pillar/network.sls
@@ -88,3 +88,30 @@
       #     initial_interval: 12
       #     reject:
       #       - 10.0.4.0/24
+    systemd:
+      link:
+        10-iface-dmz:
+          match:
+            type: eth
+            # MACAddress: c8:5b:7f:a5:1a:da
+            # OriginalName: eth0
+          link:
+            name: dmz0
+      netdev:
+        20-bridge:
+          NetDev:
+             Name: br0
+             Kind: bridge
+        20-bridge-dmz:
+        # test all lowercase
+          match:
+            name: dmz0
+          network:
+            description: bridge
+            bridge: br-dmz0
+      network:
+        40-dhcp:
+          Match:
+            Name: '*'
+          Network:
+            DHCP: yes