Merge ~wesley-wiedenmeier/cloud-init:net-update into cloud-init:master

Proposed by Wesley Wiedenmeier
Status: Rejected
Rejected by: Scott Moser
Proposed branch: ~wesley-wiedenmeier/cloud-init:net-update
Merge into: cloud-init:master
Diff against target: 115 lines (+77/-2)
2 files modified
cloudinit/net/eni.py (+1/-1)
tests/unittests/test_net.py (+76/-1)
Reviewer Review Type Date Requested Status
cloud-init Commiters Pending
Review via email: mp+316422@code.launchpad.net

Description of the change

Update unit tests for network and make minor updates to network features based on curtin.net

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

We now have better test coverage in cloud-init including the multiple addresses
for both ipv4 and ipv6 and ENI rendering.

the only thing left is 'hwaddress ether'.
And everything I read in interfaces(5) does not idnicate 'ether' is needed.
also, we do support *reading* ENI that has 'hwadress ether', but unless there is an example of why we need this, i think its best to ignore that part for now.

so i'm going to mark this 'rejected'. I hate how harsh that word sounds.
please feel free to re-submit and justfify.

Revision history for this message
Scott Moser (smoser) wrote :

We now have better test coverage in cloud-init including the multiple addresses
for both ipv4 and ipv6 and ENI rendering.

the only thing left is 'hwaddress ether'.
And everything I read in interfaces(5) does not idnicate 'ether' is needed.
also, we do support *reading* ENI that has 'hwadress ether', but unless there is an example of why we need this, i think its best to ignore that part for now.

so i'm going to mark this 'rejected'. I hate how harsh that word sounds.
please feel free to re-submit and justfify.

Unmerged commits

7fe4c44... by Wesley Wiedenmeier

Substitute 'hwaddress ether' rather than 'hwaddress' for 'mac_address'

56a288b... by Wesley Wiedenmeier

Updated networking unit tests based on newer curtin tests

 - add test for ipv6 aliases
 - add tests for multiple ipv4 aliases
 - substitution for mac_address should be 'hwaddress ether', not hwaddress

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index 5b249f1..6bee905 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -74,7 +74,7 @@ def _iface_add_attrs(iface, index):
74 'subnets',74 'subnets',
75 'type',75 'type',
76 ]76 ]
77 renames = {'mac_address': 'hwaddress'}77 renames = {'mac_address': 'hwaddress ether'}
78 if iface['type'] not in ['bond', 'bridge', 'vlan']:78 if iface['type'] not in ['bond', 'bridge', 'vlan']:
79 ignore_map.append('mac_address')79 ignore_map.append('mac_address')
8080
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index b77d277..c3a675e 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -280,6 +280,67 @@ NETWORK_CONFIGS = {
280 - {'type': 'dhcp6'}280 - {'type': 'dhcp6'}
281 """).rstrip(' '),281 """).rstrip(' '),
282 },282 },
283 'ipv6_aliases': {
284 'expected_eni': textwrap.dedent("""\
285 auto lo
286 iface lo inet loopback
287
288 auto eth0
289 iface eth0 inet6 static
290 address fde9:8f83:4a81:1:0:1:0:6/64
291
292 # control-alias eth0
293 iface eth0 inet static
294 address 192.168.0.1/24
295 """).rstrip(' '),
296 'yaml': textwrap.dedent("""\
297 version: 1
298 config:
299 - type: physical
300 name: eth0
301 mac_address: "c0:d6:9f:2c:e8:80"
302 subnets:
303 - type: static
304 address: fde9:8f83:4a81:1:0:1:0:6/64
305 - type: static
306 address: 192.168.0.1/24
307 """).rstrip(' '),
308 },
309 'ipv4_multiple_aliases': {
310 'expected_eni': textwrap.dedent("""\
311 auto lo
312 iface lo inet loopback
313
314 auto interface1
315 iface interface1 inet dhcp
316
317 # control-alias interface1
318 iface interface1 inet static
319 address 192.168.2.2/22
320 gateway 192.168.2.1
321
322 # control-alias interface1
323 iface interface1 inet static
324 address 10.23.23.7/23
325 gateway 10.23.23.1
326 """).rstrip(' '),
327 'yaml': textwrap.dedent("""\
328 version: 1
329 config:
330 # multi_v4_aliases: multiple v4 addrs on same interface
331 - type: physical
332 name: interface1
333 mac_address: "52:54:00:12:34:02"
334 subnets:
335 - type: dhcp
336 - type: static
337 address: 192.168.2.2/22
338 gateway: 192.168.2.1
339 - type: static
340 address: 10.23.23.7/23
341 gateway: 10.23.23.1
342 """).rstrip(' '),
343 },
283 'all': {344 'all': {
284 'expected_eni': ("""\345 'expected_eni': ("""\
285auto lo346auto lo
@@ -310,7 +371,7 @@ auto bond0
310iface bond0 inet6 dhcp371iface bond0 inet6 dhcp
311 bond-mode active-backup372 bond-mode active-backup
312 bond-slaves none373 bond-slaves none
313 hwaddress aa:bb:cc:dd:ee:ff374 hwaddress ether aa:bb:cc:dd:ee:ff
314375
315auto br0376auto br0
316iface br0 inet static377iface br0 inet static
@@ -780,6 +841,20 @@ class TestEniRoundTrip(CiTestCase):
780 entry['expected_eni'].splitlines(),841 entry['expected_eni'].splitlines(),
781 files['/etc/network/interfaces'].splitlines())842 files['/etc/network/interfaces'].splitlines())
782843
844 def testsimple_render_interfaces_ipv6_aliases(self):
845 entry = NETWORK_CONFIGS['ipv6_aliases']
846 files = self._render_and_read(network_config=yaml.load(entry['yaml']))
847 self.assertEqual(
848 entry['expected_eni'].splitlines(),
849 files['/etc/network/interfaces'].splitlines())
850
851 def testsimple_render_interfaces_ipv4_multiple_aliases(self):
852 entry = NETWORK_CONFIGS['ipv4_multiple_aliases']
853 files = self._render_and_read(network_config=yaml.load(entry['yaml']))
854 self.assertEqual(
855 entry['expected_eni'].splitlines(),
856 files['/etc/network/interfaces'].splitlines())
857
783 def test_routes_rendered(self):858 def test_routes_rendered(self):
784 # as reported in bug 1649652859 # as reported in bug 1649652
785 conf = [860 conf = [

Subscribers

People subscribed via source and target branches