summaryrefslogtreecommitdiff
path: root/cloudinit/distros/net_util.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-01-22 12:39:37 -0800
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-01-22 12:39:37 -0800
commit5f14b91c2a17101e845ee18068c7bb8c3c7a0556 (patch)
tree7e6105790bac9f58727776b5c06c9aaa0df67221 /cloudinit/distros/net_util.py
parent31ece5e92797bf20141878de5dd7cd91559cb336 (diff)
downloadvyos-cloud-init-5f14b91c2a17101e845ee18068c7bb8c3c7a0556.tar.gz
vyos-cloud-init-5f14b91c2a17101e845ee18068c7bb8c3c7a0556.zip
Add comments as to format with example in/out
Diffstat (limited to 'cloudinit/distros/net_util.py')
-rw-r--r--cloudinit/distros/net_util.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/cloudinit/distros/net_util.py b/cloudinit/distros/net_util.py
index 4c9095be..8c781f9a 100644
--- a/cloudinit/distros/net_util.py
+++ b/cloudinit/distros/net_util.py
@@ -26,6 +26,58 @@
# distributions that use other formats.
#
# TODO(harlowja) remove when we have python-netcf active...
+#
+# The format is the following:
+# {
+# <device-name>: {
+# # All optional (if not existent in original format)
+# "netmask": <ip>,
+# "broadcast": <ip>,
+# "gateway": <ip>,
+# "address": <ip>,
+# "bootproto": "static"|"dhcp",
+# "dns-search": <hostname>,
+# "hwaddress": <mac-address>,
+# "auto": True (or non-existent),
+# "dns-nameservers": [<ip/hostname>, ...],
+# }
+# }
+#
+# Things to note, comments are removed, if a ubuntu/debian interface is
+# marked as auto then only then first segment (?) is retained, ie
+# 'auto eth0 eth0:1' just marks eth0 as auto (not eth0:1).
+#
+# Example input:
+#
+# auto lo
+# iface lo inet loopback
+#
+# auto eth0
+# iface eth0 inet static
+# address 10.0.0.1
+# netmask 255.255.252.0
+# broadcast 10.0.0.255
+# gateway 10.0.0.2
+# dns-nameservers 98.0.0.1 98.0.0.2
+#
+# Example output:
+# {
+# "lo": {
+# "auto": true
+# },
+# "eth0": {
+# "auto": true,
+# "dns-nameservers": [
+# "98.0.0.1",
+# "98.0.0.2"
+# ],
+# "broadcast": "10.0.0.255",
+# "netmask": "255.255.252.0",
+# "bootproto": "static",
+# "address": "10.0.0.1",
+# "gateway": "10.0.0.2"
+# }
+# }
def translate_network(settings):
# Get the standard cmd, args from the ubuntu format
entries = []