~curtin-dev/curtin/trunk

« back to all changes in this revision

Viewing changes to tests/vmtests/test_multipath.py

  • Committer: Ryan Harper
  • Date: 2016-08-29 21:06:46 UTC
  • mfrom: (416.4.28 trunk.more-ipv6)
  • Revision ID: ryan.harper@canonical.com-20160829210646-1f9pv8r691iggedz
curtin/net: overhaul of eni rendering to handle mixed ipv4/ipv6 configs

To ensure complete ipv4/ipv6 support for advanced and stacked
configurations update how curtin.net renders /etc/network/interfaces for
different releases (precise -> yakkety). ifupdown has subtle issues with
various networking features and curtin needs to ensure consistent
behavior.

- Propery handle emitting the 'auto' control tag for stacked interfaces,
  like vlans over bonds
- Workaround LP:1609367 by rendering ifupdown hooks to handle the various
  cases. This works generically in all ubuntu releases 
- Add vmtests for mtu settings
- Drop the use of ipv4 alias interfaces (eth0:1, eth0:2) and instead just
  add additional e/n/i stanzas. ifupdown already uses iproute2's /sbin/ip
  which supports adding additional ip addresses to an interface without the
  use of the v4-only interface alias structure. This provides consistent
  behavior for all types of interfaces (physical, vlan, bonds, and stacked
  interfaces) across all releases. Two side-effects: 1) users can no longer
  `ifdown eth0:1` to remove a single ip address from an interface; if down
  eth0 will take _all_ ip addresses on that interface. 2) ifconfig output
  only shows *one* ipv4 address, so users will need to use /sbin/ip addr
  show <interface> to see all ip addresses assigned to an interface.
- Add vmtests for alias settings
- Restructure all of the common network testcases into a single class
  TestNetworkTestBaseAbs, all varients testing network inherit from this
  class and override only the config file and any special case test-cases
  and file collection
- Global replace of testcase use of 'with open' and instead use
  load_collect_file()
  - Fix falsepositive uefi and multipath test this replacement exposed.
- Add ip_a_to_dict parser for `/sbin/ip a` output
  - drop ifconfig_a parser

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from . import VMBaseClass
2
2
from .releases import base_vm_classes as relbase
3
3
 
4
 
import os
5
4
import textwrap
6
5
 
7
6
 
29
28
        ls -al /dev/disk/by-uuid/ > ls_uuid
30
29
        ls -al /dev/disk/by-id/ > ls_disk_id
31
30
        readlink -f /sys/class/block/sda/holders/dm-0 > holders_sda
32
 
        readlink /sys/class/block/sdb/holders/dm-0 > holders_sdb
 
31
        readlink -f /sys/class/block/sdb/holders/dm-0 > holders_sdb
33
32
        cat /etc/fstab > fstab
34
33
        mkdir -p /dev/disk/by-dname
35
34
        ls /dev/disk/by-dname/ > ls_dname
37
36
        """)]
38
37
 
39
38
    def test_multipath_disks_match(self):
40
 
        sda = os.path.join(self.td.collect, 'holders_sda')
41
 
        sdb = os.path.join(self.td.collect, 'holders_sdb')
42
 
        self.assertTrue(os.path.exists(sda))
43
 
        self.assertTrue(os.path.exists(sdb))
44
 
        with open(sda, 'r') as fp:
45
 
            sda_data = fp.read()
46
 
            print('sda holders:\n%s' % sda_data)
47
 
        with open(sda, 'r') as fp:
48
 
            sdb_data = fp.read()
49
 
            print('sdb holders:\n%s' % sda_data)
50
 
 
 
39
        sda_data = self.load_collect_file("holders_sda")
 
40
        print('sda holders:\n%s' % sda_data)
 
41
        sdb_data = self.load_collect_file("holders_sdb")
 
42
        print('sdb holders:\n%s' % sdb_data)
51
43
        self.assertEqual(sda_data, sdb_data)
52
44
 
53
45