summaryrefslogtreecommitdiff
path: root/cloudinit/net/eni.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2017-03-19 08:39:01 -0500
committerScott Moser <smoser@brickies.net>2017-03-20 15:59:03 -0400
commitef18b8ac4cf7e3dfd98830fbdb298380a192a0fc (patch)
tree19806d975057906806bd4e62b795e77a7a6af3c4 /cloudinit/net/eni.py
parent9040e78feb7c1bcf3a1dab0ee163efaa0d21612c (diff)
downloadvyos-cloud-init-ef18b8ac4cf7e3dfd98830fbdb298380a192a0fc.tar.gz
vyos-cloud-init-ef18b8ac4cf7e3dfd98830fbdb298380a192a0fc.zip
cloudinit.net: add network config v2 parsing and rendering
Network configuration version 2 format is implemented in a package called netplan (nplan)[1] which allows consolidated network config for multiple network controllers. - Add a new netplan renderer - Update default policy, placing eni and sysconfig first This requires explicit policy to enable netplan over eni on systems which have both (Yakkety, Zesty, UC16) - Allow any network state (parsed from any format cloud-init supports) to render to v2 if system supports netplan. - Move eni's _subnet_is_ipv6 to common code for use by other renderers - Make sysconfig renderer always emit /etc/syconfig/network configuration - Update cloud-init.service systemd unit to also wait on systemd-networkd-wait-online.service 1. https://lists.ubuntu.com/archives/ubuntu-devel/2016-July/039464.html
Diffstat (limited to 'cloudinit/net/eni.py')
-rw-r--r--cloudinit/net/eni.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index f471e05f..9819d4f5 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -8,6 +8,7 @@ import re
from . import ParserError
from . import renderer
+from .network_state import subnet_is_ipv6
from cloudinit import util
@@ -111,16 +112,6 @@ def _iface_start_entry(iface, index, render_hwaddress=False):
return lines
-def _subnet_is_ipv6(subnet):
- # 'static6' or 'dhcp6'
- if subnet['type'].endswith('6'):
- # This is a request for DHCPv6.
- return True
- elif subnet['type'] == 'static' and ":" in subnet['address']:
- return True
- return False
-
-
def _parse_deb_config_data(ifaces, contents, src_dir, src_path):
"""Parses the file contents, placing result into ifaces.
@@ -370,7 +361,7 @@ class Renderer(renderer.Renderer):
iface['mode'] = subnet['type']
iface['control'] = subnet.get('control', 'auto')
subnet_inet = 'inet'
- if _subnet_is_ipv6(subnet):
+ if subnet_is_ipv6(subnet):
subnet_inet += '6'
iface['inet'] = subnet_inet
if subnet['type'].startswith('dhcp'):
@@ -486,7 +477,7 @@ class Renderer(renderer.Renderer):
def network_state_to_eni(network_state, header=None, render_hwaddress=False):
# render the provided network state, return a string of equivalent eni
eni_path = 'etc/network/interfaces'
- renderer = Renderer({
+ renderer = Renderer(config={
'eni_path': eni_path,
'eni_header': header,
'links_path_prefix': None,