~curtin-dev/curtin/trunk

« back to all changes in this revision

Viewing changes to tests/vmtests/test_network_bonding.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
from . import logger
 
2
from .releases import base_vm_classes as relbase
 
3
from .test_network import TestNetworkBaseTestsAbs
 
4
 
 
5
import textwrap
 
6
 
 
7
 
 
8
class TestNetworkBondingAbs(TestNetworkBaseTestsAbs):
 
9
    conf_file = "examples/tests/bonding_network.yaml"
 
10
    collect_scripts = TestNetworkBaseTestsAbs.collect_scripts + [
 
11
        textwrap.dedent("""
 
12
        cd OUTPUT_COLLECT_D
 
13
        dpkg-query -W -f '${Status}' ifenslave > ifenslave_installed
 
14
        """)]
 
15
 
 
16
    def test_output_files_exist_ifenslave(self):
 
17
        self.output_files_exist(["ifenslave_installed"])
 
18
 
 
19
    def test_ifenslave_installed(self):
 
20
        status = self.load_collect_file("ifenslave_installed")
 
21
        logger.debug('ifenslave installed: {}'.format(status))
 
22
        self.assertEqual('install ok installed', status)
 
23
 
 
24
 
 
25
class PreciseHWETTestBonding(relbase.precise_hwe_t, TestNetworkBondingAbs):
 
26
    __test__ = True
 
27
    # package names on precise are different, need to check on ifenslave-2.6
 
28
    collect_scripts = TestNetworkBondingAbs.collect_scripts + [
 
29
        textwrap.dedent("""
 
30
        cd OUTPUT_COLLECT_D
 
31
        dpkg-query -W -f '${Status}' ifenslave-2.6 > ifenslave_installed
 
32
        """)]
 
33
 
 
34
 
 
35
class TrustyTestBonding(relbase.trusty, TestNetworkBondingAbs):
 
36
    __test__ = False
 
37
 
 
38
 
 
39
class TrustyHWEUTestBonding(relbase.trusty_hwe_u, TrustyTestBonding):
 
40
    __test__ = True
 
41
 
 
42
 
 
43
class TrustyHWEVTestBonding(relbase.trusty_hwe_v, TrustyTestBonding):
 
44
    # Working, but off by default to safe test suite runtime
 
45
    # oldest/newest HWE-* covered above/below
 
46
    __test__ = False
 
47
 
 
48
 
 
49
class TrustyHWEWTestBonding(relbase.trusty_hwe_w, TrustyTestBonding):
 
50
    __test__ = True
 
51
 
 
52
 
 
53
class WilyTestBonding(relbase.wily, TestNetworkBondingAbs):
 
54
    # EOL - 2016-07-28
 
55
    __test__ = False
 
56
 
 
57
 
 
58
class XenialTestBonding(relbase.xenial, TestNetworkBondingAbs):
 
59
    __test__ = True
 
60
 
 
61
 
 
62
class YakketyTestBonding(relbase.yakkety, TestNetworkBondingAbs):
 
63
    __test__ = True