~smoser/ubuntu/xenial/curtin/pkg

« back to all changes in this revision

Viewing changes to tests/vmtests/test_network.py

  • Committer: Ryan Harper
  • Date: 2016-10-03 18:43:46 UTC
  • mfrom: (1.2.2)
  • Revision ID: ryan.harper@canonical.com-20161003184346-pvdgp51jhexx3zox
* New upstream snapshot.
  - unittest,tox.ini: catch and fix issue with trusty-level mock of open 
  - block/mdadm: add option to ignore mdadm_assemble errors  (LP: #1618429)
  - curtin/doc: overhaul curtin documentation for readthedocs.org  (LP: #1351085)
  - curtin.util: re-add support for RunInChroot  (LP: #1617375)
  - curtin/net: overhaul of eni rendering to handle mixed ipv4/ipv6 configs 
  - curtin.block: refactor clear_holders logic into block.clear_holders and cli cmd 
  - curtin.apply_net should exit non-zero upon exception.  (LP: #1615780)
  - apt: fix bug in disable_suites if sources.list line is blank. 
  - vmtests: disable Wily in vmtests 
  - Fix the unittests for test_apt_source. 
  - get CURTIN_VMTEST_PARALLEL shown correctly in jenkins-runner output 
  - fix vmtest check_file_strippedline to strip lines before comparing 
  - fix whitespace damage in tests/vmtests/__init__.py 
  - fix dpkg-reconfigure when debconf_selections was provided.  (LP: #1609614)
  - fix apt tests on non-intel arch 
  - Add apt features to curtin.  (LP: #1574113)
  - vmtest: easier use of parallel and controlling timeouts 
  - mkfs.vfat: add force flag for formating whole disks  (LP: #1597923)
  - block.mkfs: fix sectorsize flag  (LP: #1597522)
  - block_meta: cleanup use of sys_block_path and handle cciss knames  (LP: #1562249)
  - block.get_blockdev_sector_size: handle _lsblock multi result return  (LP: #1598310)
  - util: add target (chroot) support to subp, add target_path helper. 
  - block_meta: fallback to parted if blkid does not produce output  (LP: #1524031)
  - commands.block_wipe:  correct default wipe mode to 'superblock' 
  - tox.ini: run coverage normally rather than separately 
  - move uefi boot knowledge from launch and vmtest to xkvm 

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import ipaddress
5
5
import os
6
6
import re
7
 
import subprocess
8
7
import textwrap
9
8
import yaml
10
9
 
11
10
 
12
 
class TestNetworkAbs(VMBaseClass):
 
11
class TestNetworkBaseTestsAbs(VMBaseClass):
13
12
    interactive = False
14
 
    conf_file = "examples/tests/basic_network.yaml"
15
13
    extra_disks = []
16
14
    extra_nics = []
17
15
    collect_scripts = [textwrap.dedent("""
18
16
        cd OUTPUT_COLLECT_D
 
17
        echo "waiting for ipv6 to settle" && sleep 5
19
18
        ifconfig -a > ifconfig_a
 
19
        ip link show > ip_link_show
 
20
        ip a > ip_a
 
21
        find /etc/network/interfaces.d > find_interfacesd
20
22
        cp -av /etc/network/interfaces .
21
23
        cp -av /etc/network/interfaces.d .
22
 
        find /etc/network/interfaces.d > find_interfacesd
23
24
        cp /etc/resolv.conf .
24
25
        cp -av /etc/udev/rules.d/70-persistent-net.rules .
25
26
        ip -o route show > ip_route_show
 
27
        ip -6 -o route show > ip_6_route_show
26
28
        route -n > route_n
 
29
        route -6 -n > route_6_n
27
30
        cp -av /run/network ./run_network
 
31
        cp -av /var/log/upstart ./upstart ||:
 
32
        sleep 10 && ip a > ip_a
28
33
        """)]
29
34
 
30
35
    def test_output_files_exist(self):
31
 
        self.output_files_exist(["ifconfig_a",
32
 
                                 "interfaces",
33
 
                                 "resolv.conf",
34
 
                                 "70-persistent-net.rules",
35
 
                                 "ip_route_show",
36
 
                                 "route_n"])
 
36
        self.output_files_exist([
 
37
            "70-persistent-net.rules",
 
38
            "find_interfacesd",
 
39
            "ifconfig_a",
 
40
            "interfaces",
 
41
            "ip_a",
 
42
            "ip_route_show",
 
43
            "resolv.conf",
 
44
            "route_6_n",
 
45
            "route_n",
 
46
        ])
37
47
 
38
48
    def test_etc_network_interfaces(self):
39
49
        with open(os.path.join(self.td.collect, "interfaces")) as fp:
76
86
        '''
77
87
        expected_ifaces = self.get_expected_etc_resolvconf()
78
88
        logger.debug('parsed eni ifaces:\n{}'.format(expected_ifaces))
 
89
 
 
90
        def _mk_dns_lines(dns_type, config):
 
91
            """ nameservers get a line per ns
 
92
                search is a space-separated list """
 
93
            lines = []
 
94
            if dns_type == 'nameservers':
 
95
                if ' ' in config:
 
96
                    config = config.split()
 
97
                for ns in config:
 
98
                    lines.append("nameserver %s" % ns)
 
99
            elif dns_type == 'search':
 
100
                if isinstance(config, list):
 
101
                    config = " ".join(config)
 
102
                lines.append("search %s" % config)
 
103
 
 
104
            return lines
 
105
 
79
106
        for ifname in expected_ifaces.keys():
80
107
            iface = expected_ifaces.get(ifname)
81
108
            for k, v in iface.get('dns', {}).items():
82
 
                dns_line = '{} {}'.format(
83
 
                    k.replace('nameservers', 'nameserver'), " ".join(v))
84
 
                logger.debug('dns_line:{}'.format(dns_line))
85
 
                self.assertTrue(dns_line in resolv_lines)
 
109
                print('k=%s v=%s' % (k, v))
 
110
                for dns_line in _mk_dns_lines(k, v):
 
111
                    logger.debug('dns_line:%s', dns_line)
 
112
                    self.assertTrue(dns_line in resolv_lines)
86
113
 
87
 
    def test_ifconfig_output(self):
88
 
        '''check ifconfig output with test input'''
 
114
    def test_ip_output(self):
 
115
        '''check iproute2 'ip a' output with test input'''
89
116
        network_state = self.get_network_state()
90
117
        logger.debug('expected_network_state:\n{}'.format(
91
118
            yaml.dump(network_state, default_flow_style=False, indent=4)))
92
119
 
93
 
        with open(os.path.join(self.td.collect, "ifconfig_a")) as fp:
94
 
            ifconfig_a = fp.read()
95
 
            logger.debug('ifconfig -a:\n{}'.format(ifconfig_a))
 
120
        with open(os.path.join(self.td.collect, "ip_a")) as fp:
 
121
            ip_a = fp.read()
 
122
            logger.debug('ip a:\n{}'.format(ip_a))
96
123
 
97
 
        ifconfig_dict = helpers.ifconfig_to_dict(ifconfig_a)
98
 
        logger.debug('parsed ifcfg dict:\n{}'.format(
99
 
            yaml.dump(ifconfig_dict, default_flow_style=False, indent=4)))
 
124
        ip_dict = helpers.ip_a_to_dict(ip_a)
 
125
        print('parsed ip_a dict:\n{}'.format(
 
126
            yaml.dump(ip_dict, default_flow_style=False, indent=4)))
100
127
 
101
128
        with open(os.path.join(self.td.collect, "ip_route_show")) as fp:
102
129
            ip_route_show = fp.read()
115
142
            route_n = fp.read()
116
143
            logger.debug("route -n:\n{}".format(route_n))
117
144
 
 
145
        with open(os.path.join(self.td.collect, "route_6_n")) as fp:
 
146
            route_6_n = fp.read()
 
147
            logger.debug("route -6 -n:\n{}".format(route_6_n))
 
148
 
 
149
        routes = {
 
150
            '4': route_n,
 
151
            '6': route_6_n,
 
152
        }
118
153
        interfaces = network_state.get('interfaces')
119
154
        for iface in interfaces.values():
120
 
            subnets = iface.get('subnets', {})
121
 
            if subnets:
122
 
                for index, subnet in zip(range(0, len(subnets)), subnets):
123
 
                    iface['index'] = index
124
 
                    if index == 0:
125
 
                        ifname = "{name}".format(**iface)
126
 
                    else:
127
 
                        ifname = "{name}:{index}".format(**iface)
128
 
 
129
 
                    self.check_interface(iface,
130
 
                                         ifconfig_dict.get(ifname),
131
 
                                         route_n)
132
 
            else:
133
 
                iface['index'] = 0
134
 
                self.check_interface(iface,
135
 
                                     ifconfig_dict.get(iface['name']),
136
 
                                     route_n)
137
 
 
138
 
    def check_interface(self, iface, ifconfig, route_n):
139
 
        logger.debug(
140
 
            'testing iface:\n{}\n\nifconfig:\n{}'.format(iface, ifconfig))
141
 
        subnets = iface.get('subnets', {})
142
 
        if subnets and iface['index'] != 0:
143
 
            ifname = "{name}:{index}".format(**iface)
144
 
        else:
145
 
            ifname = "{name}".format(**iface)
146
 
 
 
155
            print("\nnetwork_state iface: %s" % (
 
156
                yaml.dump(iface, default_flow_style=False, indent=4)))
 
157
            self.check_interface(iface['name'],
 
158
                                 iface,
 
159
                                 ip_dict.get(iface['name']),
 
160
                                 routes)
 
161
 
 
162
    def check_interface(self, ifname, iface, ipcfg, routes):
 
163
        print('check_interface: testing '
 
164
              'ifname:{}\niface:\n{}\n\nipcfg:\n{}'.format(ifname, iface,
 
165
                                                           ipcfg))
 
166
        # FIXME: remove check?
147
167
        # initial check, do we have the correct iface ?
148
 
        logger.debug('ifname={}'.format(ifname))
149
 
        logger.debug("ifconfig['interface']={}".format(ifconfig['interface']))
150
 
        self.assertEqual(ifname, ifconfig['interface'])
151
 
 
152
 
        # check physical interface attributes
153
 
        for key in ['mac_address', 'mtu']:
 
168
        print('ifname={}'.format(ifname))
 
169
        self.assertEqual(ifname, ipcfg['interface'])
 
170
        print("ipcfg['interface']={}".format(ipcfg['interface']))
 
171
 
 
172
        # check physical interface attributes (skip bond members, macs change)
 
173
        if iface['type'] in ['physical'] and 'bond-master' not in iface:
 
174
            for key in ['mac_address']:
 
175
                print("checking mac on iface: %s" % iface['name'])
 
176
                if key in iface and iface[key]:
 
177
                    self.assertEqual(iface[key].lower(),
 
178
                                     ipcfg[key].lower())
 
179
 
 
180
        # we can check mtu on all interfaces
 
181
        for key in ['mtu']:
154
182
            if key in iface and iface[key]:
155
 
                self.assertEqual(iface[key],
156
 
                                 ifconfig[key])
157
 
 
158
 
        def __get_subnet(subnets, subidx):
159
 
            for index, subnet in zip(range(0, len(subnets)), subnets):
160
 
                if index == subidx:
161
 
                    break
162
 
            return subnet
163
 
 
164
 
        # check subnet related attributes, and specifically only
165
 
        # the subnet specified by iface['index']
166
 
        subnets = iface.get('subnets', {})
167
 
        if subnets:
168
 
            subnet = __get_subnet(subnets, iface['index'])
 
183
                print("checking mtu on iface: %s" % iface['name'])
 
184
                self.assertEqual(int(iface[key]),
 
185
                                 int(ipcfg[key]))
 
186
 
 
187
        # check subnet related attributes
 
188
        subnets = iface.get('subnets')
 
189
        if subnets is None:
 
190
            subnets = []
 
191
        for subnet in subnets:
 
192
            config_inet_iface = None
 
193
            found_inet_iface = None
 
194
            print('validating subnet:\n%s' % subnet)
169
195
            if 'address' in subnet and subnet['address']:
 
196
                # we will create to ipaddress.IPvXInterface objects
 
197
                # one based on config, and other from collected data
 
198
                # and compare.
 
199
                config_ipstr = subnet['address']
 
200
                if 'netmask' in subnet:
 
201
                    config_ipstr += "/%s" % subnet['netmask']
 
202
 
 
203
                # One more bit is how to construct the
 
204
                # right Version interface, detecting on ":" in address
 
205
                # detect ipv6 or v4
170
206
                if ':' in subnet['address']:
171
 
                    inet_iface = ipaddress.IPv6Interface(
172
 
                        subnet['address'])
173
 
                else:
174
 
                    inet_iface = ipaddress.IPv4Interface(
175
 
                        subnet['address'])
176
 
 
177
 
                # check ip addr
178
 
                self.assertEqual(str(inet_iface.ip),
179
 
                                 ifconfig['address'])
180
 
 
181
 
                self.assertEqual(str(inet_iface.netmask),
182
 
                                 ifconfig['netmask'])
183
 
 
184
 
                self.assertEqual(
185
 
                    str(inet_iface.network.broadcast_address),
186
 
                    ifconfig['broadcast'])
187
 
 
188
 
            # handle gateway by looking at routing table
189
 
            if 'gateway' in subnet and subnet['gateway']:
190
 
                gw_ip = subnet['gateway']
191
 
                gateways = [line for line in route_n.split('\n')
192
 
                            if 'UG' in line and gw_ip in line]
193
 
                logger.debug('matching gateways:\n{}'.format(gateways))
194
 
                self.assertEqual(len(gateways), 1)
195
 
                [gateways] = gateways
196
 
                (dest, gw, genmask, flags, metric, ref, use, iface) = \
197
 
                    gateways.split()
198
 
                logger.debug('expected gw:{} found gw:{}'.format(gw_ip, gw))
199
 
                self.assertEqual(gw_ip, gw)
200
 
 
201
 
 
202
 
class TestNetworkStaticAbs(TestNetworkAbs):
203
 
    conf_file = "examples/tests/basic_network_static.yaml"
204
 
 
205
 
 
206
 
class TestNetworkVlanAbs(TestNetworkAbs):
207
 
    conf_file = "examples/tests/vlan_network.yaml"
208
 
    collect_scripts = TestNetworkAbs.collect_scripts + [textwrap.dedent("""
209
 
             cd OUTPUT_COLLECT_D
210
 
             dpkg-query -W -f '${Status}' vlan > vlan_installed
211
 
             ip -d link show interface1.2667 > ip_link_show_interface1.2667
212
 
             ip -d link show interface1.2668 > ip_link_show_interface1.2668
213
 
             ip -d link show interface1.2669 > ip_link_show_interface1.2669
214
 
             ip -d link show interface1.2670 > ip_link_show_interface1.2670
215
 
             """)]
216
 
 
217
 
    def get_vlans(self):
218
 
        network_state = self.get_network_state()
219
 
        logger.debug('get_vlans ns:\n{}'.format(
220
 
            yaml.dump(network_state, default_flow_style=False, indent=4)))
221
 
        interfaces = network_state.get('interfaces')
222
 
        return [iface for iface in interfaces.values()
223
 
                if iface['type'] == 'vlan']
224
 
 
225
 
    def test_output_files_exist_vlan(self):
226
 
        link_files = ["ip_link_show_{}".format(vlan['name'])
227
 
                      for vlan in self.get_vlans()]
228
 
        self.output_files_exist(["vlan_installed"] + link_files)
229
 
 
230
 
    def test_vlan_installed(self):
231
 
        with open(os.path.join(self.td.collect, "vlan_installed")) as fp:
232
 
            status = fp.read().strip()
233
 
            logger.debug('vlan installed?: {}'.format(status))
234
 
            self.assertEqual('install ok installed', status)
235
 
 
236
 
    def test_vlan_enabled(self):
237
 
 
238
 
        # we must have at least one
239
 
        self.assertGreaterEqual(len(self.get_vlans()), 1)
240
 
 
241
 
        # did they get configured?
242
 
        for vlan in self.get_vlans():
243
 
            link_file = "ip_link_show_" + vlan['name']
244
 
            vlan_msg = "vlan protocol 802.1Q id " + str(vlan['vlan_id'])
245
 
            self.check_file_regex(link_file, vlan_msg)
246
 
 
247
 
 
248
 
class TestNetworkENISource(TestNetworkAbs):
249
 
    """ Curtin now emits a source /etc/network/interfaces.d/*.cfg
250
 
        line.  This test exercises this feature by emitting additional
251
 
        network configuration in /etc/network/interfaces.d/eth2.cfg
252
 
 
253
 
        This relies on the network_config.yaml of the TestClass to
254
 
        define a spare nic with no configuration.  This ensures that
255
 
        a udev rule for eth2 is emitted so we can reference the interface
256
 
        in our injected configuration.
257
 
 
258
 
        Note, ifupdown allows multiple stanzas with the same iface name
259
 
        and combines the options together during ifup.  We rely on this
260
 
        feature allowing etc/network/interfaces to have an unconfigured
261
 
        iface eth2 inet manual line, and then defer the configuration
262
 
        to /etc/network/interfaces.d/eth2.cfg
263
 
 
264
 
        This testcase then uses curtin.net.deb_parse_config method to
265
 
        extract information about what curtin wrote and compare that
266
 
        with what was actually configured (which we capture via ifconfig)
 
207
                    # v6
 
208
                    config_inet_iface = ipaddress.IPv6Interface(config_ipstr)
 
209
                    ip_func = ipaddress.IPv6Interface
 
210
                    addresses = ipcfg.get('inet6', [])
 
211
                else:
 
212
                    # v4
 
213
                    config_inet_iface = ipaddress.IPv4Interface(config_ipstr)
 
214
                    ip_func = ipaddress.IPv4Interface
 
215
                    addresses = ipcfg.get('inet4', [])
 
216
 
 
217
                # find a matching
 
218
                print('found addresses: %s' % addresses)
 
219
                for ip in addresses:
 
220
                    print('cur ip=%s\nsubnet=%s' % (ip, subnet))
 
221
                    # drop /CIDR if present for matching
 
222
                    if (ip['address'].split("/")[0] ==
 
223
                       subnet['address'].split("/")[0]):
 
224
                        print('found a match!')
 
225
                        found_ipstr = ip['address']
 
226
                        if ('netmask' in subnet or '/' in subnet['address']):
 
227
                            found_ipstr += "/%s" % ip.get('prefixlen')
 
228
                        found_inet_iface = ip_func(found_ipstr)
 
229
                        print('returning inet iface')
 
230
                        break
 
231
 
 
232
                # check ipaddress interface matches (config vs. found)
 
233
                self.assertIsNotNone(config_inet_iface)
 
234
                self.assertIsNotNone(found_inet_iface)
 
235
                self.assertEqual(config_inet_iface, found_inet_iface)
 
236
 
 
237
            def __find_gw_config(subnet):
 
238
                gateways = []
 
239
                if 'gateway' in subnet:
 
240
                    gateways.append(subnet.get('gateway'))
 
241
                for route in subnet.get('routes', []):
 
242
                    gateways += __find_gw_config(route)
 
243
                return gateways
 
244
 
 
245
            # handle gateways by looking at routing table
 
246
            configured_gws = __find_gw_config(subnet)
 
247
            print('iface:%s configured_gws: %s' % (ifname, configured_gws))
 
248
            for gw_ip in configured_gws:
 
249
                logger.debug('found a gateway in subnet config: %s', gw_ip)
 
250
                if ":" in gw_ip:
 
251
                    route_d = routes['6']
 
252
                else:
 
253
                    route_d = routes['4']
 
254
 
 
255
                found_gws = [line for line in route_d.split('\n')
 
256
                             if 'UG' in line and gw_ip in line]
 
257
                logger.debug('found gateways in guest output:\n%s', found_gws)
 
258
 
 
259
                print('found_gws: %s\nexpected: %s' % (found_gws,
 
260
                                                       configured_gws))
 
261
                self.assertEqual(len(found_gws), len(configured_gws))
 
262
                for fgw in found_gws:
 
263
                    if ":" in gw_ip:
 
264
                        (dest, gw, flags, metric, ref, use, iface) = \
 
265
                            fgw.split()
 
266
                    else:
 
267
                        (dest, gw, genmask, flags, metric, ref, use, iface) = \
 
268
                            fgw.split()
 
269
                    logger.debug('configured gw:%s found gw:%s', gw_ip, gw)
 
270
                    self.assertEqual(gw_ip, gw)
 
271
 
 
272
 
 
273
class TestNetworkBasicAbs(TestNetworkBaseTestsAbs):
 
274
    """ Basic network testing with ipv4
267
275
    """
268
 
 
269
 
    conf_file = "examples/tests/network_source.yaml"
270
 
    collect_scripts = [textwrap.dedent("""
271
 
        cd OUTPUT_COLLECT_D
272
 
        ifconfig -a > ifconfig_a
273
 
        cp -av /etc/network/interfaces .
274
 
        cp -a /etc/network/interfaces.d .
275
 
        find /etc/network/interfaces.d > find_interfacesd
276
 
        cp /etc/resolv.conf .
277
 
        cp -av /etc/udev/rules.d/70-persistent-net.rules .
278
 
        ip -o route show > ip_route_show
279
 
        route -n > route_n
280
 
        """)]
281
 
 
282
 
    def test_source_cfg_exists(self):
283
 
        """Test that our curthooks wrote our injected config."""
284
 
        self.output_files_exist(["interfaces.d/interface2.cfg"])
285
 
 
286
 
    def test_etc_network_interfaces_source_cfg(self):
287
 
        """ Compare injected configuration as parsed by curtin matches
288
 
            how ifup configured the interface."""
289
 
        # interfaces uses absolute paths, fix for test-case
290
 
        interfaces = os.path.join(self.td.collect, "interfaces")
291
 
        cmd = ['sed', '-i.orig', '-e', 's,/etc/network/,,g',
292
 
               '{}'.format(interfaces)]
293
 
        subprocess.check_call(cmd, stderr=subprocess.STDOUT)
294
 
 
295
 
        curtin_ifaces = self.parse_deb_config(interfaces)
296
 
        logger.debug('parsed eni dict:\n{}'.format(
297
 
            yaml.dump(curtin_ifaces, default_flow_style=False, indent=4)))
298
 
        print('parsed eni dict:\n{}'.format(
299
 
            yaml.dump(curtin_ifaces, default_flow_style=False, indent=4)))
300
 
 
301
 
        with open(os.path.join(self.td.collect, "ifconfig_a")) as fp:
302
 
            ifconfig_a = fp.read()
303
 
            logger.debug('ifconfig -a:\n{}'.format(ifconfig_a))
304
 
 
305
 
        ifconfig_dict = helpers.ifconfig_to_dict(ifconfig_a)
306
 
        logger.debug('parsed ifconfig dict:\n{}'.format(
307
 
            yaml.dump(ifconfig_dict, default_flow_style=False, indent=4)))
308
 
        print('parsed ifconfig dict:\n{}'.format(
309
 
            yaml.dump(ifconfig_dict, default_flow_style=False, indent=4)))
310
 
 
311
 
        iface = 'interface2'
312
 
        self.assertTrue(iface in curtin_ifaces)
313
 
 
314
 
        expected_address = curtin_ifaces[iface].get('address', None)
315
 
        self.assertIsNotNone(expected_address)
316
 
 
317
 
        # handle CIDR notation
318
 
        def _nocidr(addr):
319
 
            return addr.split("/")[0]
320
 
        actual_address = ifconfig_dict[iface].get('address', "")
321
 
        self.assertEqual(_nocidr(expected_address), _nocidr(actual_address))
322
 
 
323
 
 
324
 
class PreciseHWETTestNetwork(relbase.precise_hwe_t, TestNetworkAbs):
325
 
    # FIXME: off due to hang at test: Starting execute cloud user/final scripts
326
 
    __test__ = False
327
 
 
328
 
 
329
 
class PreciseHWETTestNetworkStatic(relbase.precise_hwe_t,
330
 
                                   TestNetworkStaticAbs):
331
 
    # FIXME: off due to hang at test: Starting execute cloud user/final scripts
332
 
    __test__ = False
333
 
 
334
 
 
335
 
class TrustyTestNetwork(relbase.trusty, TestNetworkAbs):
336
 
    __test__ = True
337
 
 
338
 
 
339
 
class TrustyTestNetworkStatic(relbase.trusty, TestNetworkStaticAbs):
340
 
    __test__ = True
341
 
 
342
 
 
343
 
class TrustyHWEUTestNetwork(relbase.trusty_hwe_u, TrustyTestNetwork):
344
 
    # Working, off by default to safe test suite runtime, covered by bonding
345
 
    __test__ = False
346
 
 
347
 
 
348
 
class TrustyHWEUTestNetworkStatic(relbase.trusty_hwe_u,
349
 
                                  TestNetworkStaticAbs):
350
 
    # Working, off by default to safe test suite runtime, covered by bonding
351
 
    __test__ = False
352
 
 
353
 
 
354
 
class TrustyHWEVTestNetwork(relbase.trusty_hwe_v, TrustyTestNetwork):
355
 
    # Working, off by default to safe test suite runtime, covered by bonding
356
 
    __test__ = False
357
 
 
358
 
 
359
 
class TrustyHWEVTestNetworkStatic(relbase.trusty_hwe_v,
360
 
                                  TestNetworkStaticAbs):
361
 
    # Working, off by default to safe test suite runtime, covered by bonding
362
 
    __test__ = False
363
 
 
364
 
 
365
 
class TrustyHWEWTestNetwork(relbase.trusty_hwe_w, TrustyTestNetwork):
366
 
    # Working, off by default to safe test suite runtime, covered by bonding
367
 
    __test__ = False
368
 
 
369
 
 
370
 
class TrustyHWEWTestNetworkStatic(relbase.trusty_hwe_w,
371
 
                                  TestNetworkStaticAbs):
372
 
    # Working, off by default to safe test suite runtime, covered by bonding
373
 
    __test__ = False
374
 
 
375
 
 
376
 
class WilyTestNetwork(relbase.wily, TestNetworkAbs):
377
 
    __test__ = True
378
 
 
379
 
 
380
 
class WilyTestNetworkStatic(relbase.wily, TestNetworkStaticAbs):
381
 
    __test__ = True
382
 
 
383
 
 
384
 
class XenialTestNetwork(relbase.xenial, TestNetworkAbs):
385
 
    __test__ = True
386
 
 
387
 
 
388
 
class XenialTestNetworkStatic(relbase.xenial, TestNetworkStaticAbs):
389
 
    __test__ = True
390
 
 
391
 
 
392
 
class YakketyTestNetwork(relbase.yakkety, TestNetworkAbs):
393
 
    __test__ = True
394
 
 
395
 
 
396
 
class YakketyTestNetworkStatic(relbase.yakkety, TestNetworkStaticAbs):
397
 
    __test__ = True
398
 
 
399
 
 
400
 
class PreciseTestNetworkVlan(relbase.precise, TestNetworkVlanAbs):
401
 
    __test__ = True
402
 
 
403
 
    # precise ip -d link show output is different (of course)
404
 
    def test_vlan_enabled(self):
405
 
 
406
 
        # we must have at least one
407
 
        self.assertGreaterEqual(len(self.get_vlans()), 1)
408
 
 
409
 
        # did they get configured?
410
 
        for vlan in self.get_vlans():
411
 
            link_file = "ip_link_show_" + vlan['name']
412
 
            vlan_msg = "vlan id " + str(vlan['vlan_id'])
413
 
            self.check_file_regex(link_file, vlan_msg)
414
 
 
415
 
 
416
 
class TrustyTestNetworkVlan(relbase.trusty, TestNetworkVlanAbs):
417
 
    __test__ = True
418
 
 
419
 
 
420
 
class WilyTestNetworkVlan(relbase.wily, TestNetworkVlanAbs):
421
 
    __test__ = True
422
 
 
423
 
 
424
 
class XenialTestNetworkVlan(relbase.xenial, TestNetworkVlanAbs):
425
 
    __test__ = True
426
 
 
427
 
 
428
 
class YakketyTestNetworkVlan(relbase.yakkety, TestNetworkVlanAbs):
429
 
    __test__ = True
430
 
 
431
 
 
432
 
class PreciseTestNetworkENISource(relbase.precise, TestNetworkENISource):
433
 
    __test__ = False
434
 
    # not working, still debugging though; possible older ifupdown doesn't
435
 
    # like the multiple iface method.
436
 
 
437
 
 
438
 
class TrustyTestNetworkENISource(relbase.trusty, TestNetworkENISource):
439
 
    __test__ = True
440
 
 
441
 
 
442
 
class WilyTestNetworkENISource(relbase.wily, TestNetworkENISource):
443
 
    __test__ = True
444
 
 
445
 
 
446
 
class XenialTestNetworkENISource(relbase.xenial, TestNetworkENISource):
447
 
    __test__ = True
448
 
 
449
 
 
450
 
class YakketyTestNetworkENISource(relbase.yakkety, TestNetworkENISource):
 
276
    conf_file = "examples/tests/basic_network.yaml"
 
277
 
 
278
 
 
279
class PreciseHWETTestNetworkBasic(relbase.precise_hwe_t, TestNetworkBasicAbs):
 
280
    # FIXME: off due to hang at test: Starting execute cloud user/final scripts
 
281
    __test__ = False
 
282
 
 
283
 
 
284
class TrustyTestNetworkBasic(relbase.trusty, TestNetworkBasicAbs):
 
285
    __test__ = True
 
286
 
 
287
 
 
288
class TrustyHWEUTestNetworkBasic(relbase.trusty_hwe_u, TrustyTestNetworkBasic):
 
289
    # Working, off by default to safe test suite runtime, covered by bonding
 
290
    __test__ = False
 
291
 
 
292
 
 
293
class TrustyHWEVTestNetworkBasic(relbase.trusty_hwe_v, TrustyTestNetworkBasic):
 
294
    # Working, off by default to safe test suite runtime, covered by bonding
 
295
    __test__ = False
 
296
 
 
297
 
 
298
class TrustyHWEWTestNetworkBasic(relbase.trusty_hwe_w, TrustyTestNetworkBasic):
 
299
    # Working, off by default to safe test suite runtime, covered by bonding
 
300
    __test__ = False
 
301
 
 
302
 
 
303
class XenialTestNetworkBasic(relbase.xenial, TestNetworkBasicAbs):
 
304
    __test__ = True
 
305
 
 
306
 
 
307
class YakketyTestNetworkBasic(relbase.yakkety, TestNetworkBasicAbs):
451
308
    __test__ = True