summaryrefslogtreecommitdiff
path: root/tests/unittests/test_net.py
diff options
context:
space:
mode:
authorAkihiko Ota <skywalker.37th@gmail.com>2017-12-13 23:46:02 +0900
committerScott Moser <smoser@ubuntu.com>2018-01-24 09:42:07 -0500
commit8a9421421497b3e7c05589c62389745d565c6633 (patch)
tree68760d6a99eb60e1848d7b27b540a01f03ef487f /tests/unittests/test_net.py
parent32a6a1764e902c31dd3af9b674cea14cd6501187 (diff)
downloadvyos-cloud-init-8a9421421497b3e7c05589c62389745d565c6633.tar.gz
vyos-cloud-init-8a9421421497b3e7c05589c62389745d565c6633.zip
OpenNebula: Improve network configuration support.
Network configuration in OpenNebula would only work if the host correctly guessed the names of the devices in the guest. OpenNebula provided data in its context.sh like 'ETH0_NETWORK', but if the guest named devices differently then results were not predictable. This would occur with Predictable Network Interface Names. To address this, newer versions (of OpenNebula provide the mac address ETH0_MAC. This function is present in 4.14 and documented officially in 5.0 docs. This provides support for reading the mac addresses from the context.sh. It also fixes cases where context.sh provided a field (ETH0_NETWORK or ETH0_MASK) with a empty string. Previously the empty string would be used rather than falling back to the default. LP: #1719157, #1716397, #1736750
Diffstat (limited to 'tests/unittests/test_net.py')
-rw-r--r--tests/unittests/test_net.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index f3fa2a30..ddea13d7 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -1,9 +1,9 @@
# This file is part of cloud-init. See LICENSE file for license information.
from cloudinit import net
-from cloudinit.net import _natural_sort_key
from cloudinit.net import cmdline
from cloudinit.net import eni
+from cloudinit.net import natural_sort_key
from cloudinit.net import netplan
from cloudinit.net import network_state
from cloudinit.net import renderers
@@ -2708,11 +2708,11 @@ class TestInterfacesSorting(CiTestCase):
def test_natural_order(self):
data = ['ens5', 'ens6', 'ens3', 'ens20', 'ens13', 'ens2']
self.assertEqual(
- sorted(data, key=_natural_sort_key),
+ sorted(data, key=natural_sort_key),
['ens2', 'ens3', 'ens5', 'ens6', 'ens13', 'ens20'])
data2 = ['enp2s0', 'enp2s3', 'enp0s3', 'enp0s13', 'enp0s8', 'enp1s2']
self.assertEqual(
- sorted(data2, key=_natural_sort_key),
+ sorted(data2, key=natural_sort_key),
['enp0s3', 'enp0s8', 'enp0s13', 'enp1s2', 'enp2s0', 'enp2s3'])