~smoser/curtin/trunk.bzr-dead

« back to all changes in this revision

Viewing changes to tests/vmtests/test_network_vlan.py

  • Committer: Scott Moser
  • Date: 2017-12-20 17:33:03 UTC
  • Revision ID: smoser@ubuntu.com-20171220173303-29gha5qb8wpqrd40
README: Mention move of revision control to git.

curtin development has moved its revision control to git.
It is available at
  https://code.launchpad.net/curtin

Clone with
  git clone https://git.launchpad.net/curtin
or
  git clone git+ssh://git.launchpad.net/curtin

For more information see
  http://curtin.readthedocs.io/en/latest/topics/development.html

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 .releases import centos_base_vm_classes as centos_relbase
4
 
from .test_network import TestNetworkBaseTestsAbs
5
 
 
6
 
import textwrap
7
 
import yaml
8
 
 
9
 
 
10
 
class TestNetworkVlanAbs(TestNetworkBaseTestsAbs):
11
 
    conf_file = "examples/tests/vlan_network.yaml"
12
 
    collect_scripts = TestNetworkBaseTestsAbs.collect_scripts + [
13
 
        textwrap.dedent("""
14
 
             cd OUTPUT_COLLECT_D
15
 
             ip -d link show interface1.2667 |tee ip_link_show_interface1.2667
16
 
             ip -d link show interface1.2668 |tee ip_link_show_interface1.2668
17
 
             ip -d link show interface1.2669 |tee ip_link_show_interface1.2669
18
 
             ip -d link show interface1.2670 |tee ip_link_show_interface1.2670
19
 
             """)]
20
 
 
21
 
    def get_vlans(self):
22
 
        network_state = self.get_network_state()
23
 
        logger.debug('get_vlans ns:\n%s', yaml.dump(network_state,
24
 
                                                    default_flow_style=False,
25
 
                                                    indent=4))
26
 
        interfaces = network_state.get('interfaces')
27
 
        return [iface for iface in interfaces.values()
28
 
                if iface['type'] == 'vlan']
29
 
 
30
 
    def test_output_files_exist_vlan(self):
31
 
        link_files = ["ip_link_show_%s" % vlan['name']
32
 
                      for vlan in self.get_vlans()]
33
 
        self.output_files_exist(link_files)
34
 
 
35
 
    def test_vlan_installed(self):
36
 
        self.assertIn("vlan", self.debian_packages, "vlan deb not installed")
37
 
 
38
 
    def test_vlan_enabled(self):
39
 
        # we must have at least one
40
 
        self.assertGreaterEqual(len(self.get_vlans()), 1)
41
 
 
42
 
        # did they get configured?
43
 
        for vlan in self.get_vlans():
44
 
            link_file = "ip_link_show_" + vlan['name']
45
 
            vlan_msg = "vlan.*id " + str(vlan['vlan_id'])
46
 
            self.check_file_regex(link_file, vlan_msg)
47
 
 
48
 
 
49
 
class CentosTestNetworkVlanAbs(TestNetworkVlanAbs):
50
 
    extra_kern_args = "BOOTIF=eth0-d4:be:d9:a8:49:13"
51
 
    collect_scripts = TestNetworkVlanAbs.collect_scripts + [
52
 
        textwrap.dedent("""
53
 
            cd OUTPUT_COLLECT_D
54
 
            cp -a /etc/sysconfig/network-scripts .
55
 
            cp -a /var/log/cloud-init* .
56
 
            cp -a /var/lib/cloud ./var_lib_cloud
57
 
            cp -a /run/cloud-init ./run_cloud-init
58
 
        """)]
59
 
 
60
 
    def test_etc_network_interfaces(self):
61
 
        pass
62
 
 
63
 
    def test_etc_resolvconf(self):
64
 
        pass
65
 
 
66
 
    def test_vlan_installed(self):
67
 
        """centos has vlan support built-in, no extra packages needed"""
68
 
        pass
69
 
 
70
 
 
71
 
class TrustyTestNetworkVlan(relbase.trusty, TestNetworkVlanAbs):
72
 
    __test__ = True
73
 
 
74
 
 
75
 
class TrustyHWEXTestNetworkVlan(relbase.trusty_hwe_x, TestNetworkVlanAbs):
76
 
    __test__ = True
77
 
 
78
 
 
79
 
class XenialTestNetworkVlan(relbase.xenial, TestNetworkVlanAbs):
80
 
    __test__ = True
81
 
 
82
 
 
83
 
class ZestyTestNetworkVlan(relbase.zesty, TestNetworkVlanAbs):
84
 
    __test__ = True
85
 
 
86
 
 
87
 
class ArtfulTestNetworkVlan(relbase.artful, TestNetworkVlanAbs):
88
 
    __test__ = True
89
 
 
90
 
 
91
 
class BionicTestNetworkVlan(relbase.bionic, TestNetworkVlanAbs):
92
 
    __test__ = True
93
 
 
94
 
 
95
 
class Centos66TestNetworkVlan(centos_relbase.centos66fromxenial,
96
 
                              CentosTestNetworkVlanAbs):
97
 
    __test__ = True
98
 
 
99
 
 
100
 
class Centos70TestNetworkVlan(centos_relbase.centos70fromxenial,
101
 
                              CentosTestNetworkVlanAbs):
102
 
    __test__ = True