Merge lp:~rvb/maas/subnet-creation into lp:~maas-maintainers/maas/networking

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 4123
Proposed branch: lp:~rvb/maas/subnet-creation
Merge into: lp:~maas-maintainers/maas/networking
Prerequisite: lp:~rvb/maas/connect-interf-subnet
Diff against target: 151 lines (+54/-13)
5 files modified
src/maasserver/models/interface.py (+7/-3)
src/maasserver/models/subnet.py (+12/-0)
src/maasserver/models/tests/test_interface.py (+21/-7)
src/maasserver/models/tests/test_subnet.py (+10/-0)
src/metadataserver/models/tests/test_commissioningscript.py (+4/-3)
To merge this branch: bzr merge lp:~rvb/maas/subnet-creation
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Blake Rouse Pending
Review via email: mp+265415@code.launchpad.net

This proposal supersedes a proposal from 2015-07-20.

Commit message

During commissioning, create unknown Subnets.

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) wrote : Posted in a previous version of this proposal

Looks good. Other than the comment below.

review: Approve
Revision history for this message
Raphaël Badin (rvb) : Posted in a previous version of this proposal
Revision history for this message
Raphaël Badin (rvb) wrote :

Just changed the target branch. Self-approving.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (83.0 KiB)

The attempt to merge lp:~rvb/maas/subnet-creation into lp:~maas-maintainers/maas/networking failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Hit http://security.ubuntu.com trusty-security Release.gpg
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://security.ubuntu.com trusty-security Release
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Hit http://nova.clouds.archive.ubuntu.com trusty-updates Release
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 phantomjs postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lockfile python-lxml python-mock python-netaddr python-netifaces python-nose python-oauth python-openssl python-paramiko python-pexpect python-pip python-pocket-lint python-psycopg2 python-pyinotify python-pyparsing python-seamicroc...

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (83.1 KiB)

The attempt to merge lp:~rvb/maas/subnet-creation into lp:~maas-maintainers/maas/networking failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Hit http://security.ubuntu.com trusty-security Release.gpg
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Hit http://security.ubuntu.com trusty-security Release
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:1 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:2 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [215 kB]
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [125 kB]
Get:5 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [570 kB]
Get:6 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [296 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,270 kB in 3s (342 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 phantomjs postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lockfile python-lxml python-mock python-netaddr python-netifaces python-nose python-oauth python-openssl python-paramiko python-pexp...

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (56.2 KiB)

The attempt to merge lp:~rvb/maas/subnet-creation into lp:~maas-maintainers/maas/networking failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Hit http://security.ubuntu.com trusty-security Release.gpg
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Hit http://security.ubuntu.com trusty-security Release
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:1 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:2 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [215 kB]
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [125 kB]
Get:5 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [570 kB]
Get:6 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [296 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Fetched 1,270 kB in 3s (348 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 phantomjs postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lockfile python-lxml python-mock python-netaddr python-netifaces python-nose python-oauth python-openssl python-paramiko python-pexp...

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (48.8 KiB)

The attempt to merge lp:~rvb/maas/subnet-creation into lp:~maas-maintainers/maas/networking failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Hit http://security.ubuntu.com trusty-security Release.gpg
Hit http://security.ubuntu.com trusty-security Release
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Hit http://nova.clouds.archive.ubuntu.com trusty-updates Release
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 phantomjs postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lockfile python-lxml python-mock python-netaddr python-netifaces python-nose python-oauth python-openssl python-paramiko python-pexpect python-pip python-pocket-lint python-psycopg2 python-pyinotify python-pyparsing python-seamicroc...

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (83.1 KiB)

The attempt to merge lp:~rvb/maas/subnet-creation into lp:~maas-maintainers/maas/networking failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Hit http://security.ubuntu.com trusty-security Release.gpg
Hit http://security.ubuntu.com trusty-security Release
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:1 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:2 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [215 kB]
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [125 kB]
Get:5 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [570 kB]
Get:6 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [296 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Fetched 1,270 kB in 9s (140 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 phantomjs postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lockfile python-lxml python-mock python-netaddr python-netifaces python-nose python-oauth python-openssl python-paramiko python-pexp...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/interface.py'
2--- src/maasserver/models/interface.py 2015-07-20 09:03:26 +0000
3+++ src/maasserver/models/interface.py 2015-07-22 10:47:10 +0000
4@@ -42,6 +42,7 @@
5 VerboseRegexValidator,
6 )
7 from maasserver.models.cleansave import CleanSave
8+from maasserver.models.space import Space
9 from maasserver.models.timestampedmodel import TimestampedModel
10 from netaddr import IPNetwork
11 from provisioningserver.logger import get_maas_logger
12@@ -140,10 +141,13 @@
13 try:
14 subnet = Subnet.objects.get(cidr=cidr, vlan__fabric=fabric)
15 except Subnet.DoesNotExist:
16- maaslog.warning(
17- "Skipping unknown subnet %s connected to interface %s "
18+ vlan = fabric.get_default_vlan()
19+ space = Space.objects.get_default_space()
20+ subnet = Subnet.objects.create_from_cidr(
21+ cidr=cidr, vlan=vlan, space=space)
22+ maaslog.info(
23+ "Creating subnet %s connected to interface %s "
24 "of node %s.", cidr, self, self.get_node())
25- continue
26
27 # This code needs to deal with both:
28 # - legacy statically configured IPs (subnet=None, mac=mac) for
29
30=== modified file 'src/maasserver/models/subnet.py'
31--- src/maasserver/models/subnet.py 2015-06-26 01:03:50 +0000
32+++ src/maasserver/models/subnet.py 2015-07-22 10:47:10 +0000
33@@ -22,6 +22,7 @@
34 from django.db.models import (
35 CharField,
36 ForeignKey,
37+ Manager,
38 PROTECT,
39 )
40 from djorm_pgarray.fields import ArrayField
41@@ -46,6 +47,15 @@
42 return VLAN.objects.get_default_vlan()
43
44
45+class SubnetManager(Manager):
46+ """Manager for :class:`Subnet` model."""
47+
48+ def create_from_cidr(self, cidr, vlan, space):
49+ """Create a subnet from the given CIDR."""
50+ name = "subnet-" + unicode(cidr)
51+ return self.create(name=name, cidr=cidr, vlan=vlan, space=space)
52+
53+
54 class Subnet(CleanSave, TimestampedModel):
55
56 class Meta(DefaultMeta):
57@@ -54,6 +64,8 @@
58 ('name', 'space'),
59 )
60
61+ objects = SubnetManager()
62+
63 name = CharField(
64 blank=False, editable=True, max_length=255,
65 validators=[SUBNET_NAME_VALIDATOR],
66
67=== modified file 'src/maasserver/models/tests/test_interface.py'
68--- src/maasserver/models/tests/test_interface.py 2015-07-17 11:14:36 +0000
69+++ src/maasserver/models/tests/test_interface.py 2015-07-22 10:47:10 +0000
70@@ -20,7 +20,10 @@
71 IPADDRESS_TYPE,
72 )
73 from maasserver.models import (
74+ Fabric,
75 MACAddress,
76+ Space,
77+ Subnet,
78 VLAN,
79 )
80 from maasserver.models.interface import (
81@@ -192,16 +195,27 @@
82
83 class UpdateIpAddressesTest(MAASServerTestCase):
84
85- def test__ignores_missing_subnet(self):
86+ def test__creates_missing_subnet(self):
87 mac = factory.make_MACAddress_with_Node()
88 interface = factory.make_Interface(
89 mac=mac, type=INTERFACE_TYPE.PHYSICAL)
90- cidr_list = [
91- unicode(factory.make_ip4_or_6_network()) for _ in range(3)]
92-
93- interface.update_ip_addresses(cidr_list)
94-
95- self.assertItemsEqual([], interface.ip_addresses.all())
96+ network = factory.make_ip4_or_6_network()
97+ cidr = unicode(network)
98+ address = unicode(network.ip)
99+ interface.update_ip_addresses([cidr])
100+
101+ default_fabric = Fabric.objects.get_default_fabric()
102+ default_space = Space.objects.get_default_space()
103+ subnets = Subnet.objects.filter(
104+ cidr=unicode(network.cidr), vlan__fabric=default_fabric,
105+ space=default_space)
106+ self.assertEqual(1, len(subnets))
107+ self.assertEqual(1, interface.ip_addresses.count())
108+ self.assertThat(
109+ interface.ip_addresses.first(),
110+ MatchesStructure.byEquality(
111+ alloc_type=IPADDRESS_TYPE.DHCP, subnet=subnets[0],
112+ ip=address))
113
114 def test__creates_dhcp_ip_addresses(self):
115 mac = factory.make_MACAddress_with_Node()
116
117=== modified file 'src/maasserver/models/tests/test_subnet.py'
118--- src/maasserver/models/tests/test_subnet.py 2015-06-19 09:53:30 +0000
119+++ src/maasserver/models/tests/test_subnet.py 2015-07-22 10:47:10 +0000
120@@ -52,3 +52,13 @@
121 self.assertEqual(
122 {'gateway_ip': ["Gateway IP must be within CIDR range."]},
123 error.message_dict)
124+
125+ def test_create_from_cidr_creates_subnet(self):
126+ vlan = factory.make_VLAN()
127+ cidr = unicode(factory.make_ip4_or_6_network().cidr)
128+ space = factory.make_Space()
129+ name = "subnet-" + cidr
130+ subnet = Subnet.objects.create_from_cidr(cidr, vlan, space)
131+ self.assertThat(subnet, MatchesStructure.byEquality(
132+ name=name, vlan=vlan, cidr=cidr, space=space,
133+ gateway_ip=None, dns_servers=[]))
134
135=== modified file 'src/metadataserver/models/tests/test_commissioningscript.py'
136--- src/metadataserver/models/tests/test_commissioningscript.py 2015-07-16 15:44:24 +0000
137+++ src/metadataserver/models/tests/test_commissioningscript.py 2015-07-22 10:47:10 +0000
138@@ -1413,9 +1413,10 @@
139
140 update_node_network_information(node, self.IP_ADDR_OUTPUT, 0)
141 eth0 = Interface.objects.get(mac__node=node, name='eth0')
142- self.assertEqual(1, eth0.ip_addresses.count())
143+ address = unicode(IPNetwork(cidr).ip)
144+ ipv4_ip = eth0.ip_addresses.get(ip=address)
145 self.assertThat(
146- eth0.ip_addresses.first(),
147+ ipv4_ip,
148 MatchesStructure.byEquality(
149 alloc_type=IPADDRESS_TYPE.DHCP, subnet=subnet,
150- ip=unicode(IPNetwork(cidr).ip)))
151+ ip=address))

Subscribers

People subscribed via source and target branches