Do not hardcode datacentre as the physical network

Currently, setup-neutron's net creation code sets the
provider:physical_network property to 'datacentre' for VLAN'd networks.
This is incorrect, and in fact is a (somewhat) obvious regression from
the earlier VLAN code before the migration.

Change-Id: I677f3de70980d1db8cf64c822ad10e07368f928e
Closes-Bug: #1398457
This commit is contained in:
Steve Kowalik 2015-01-22 15:09:20 +11:00
parent 70093fccb3
commit 9ea690d0d3
3 changed files with 16 additions and 7 deletions

View File

@ -168,13 +168,19 @@ Where /tmp/ctlplane-dc contains::
"cidr": "192.0.2.0/24",
"allocation_end": "192.0.2.20",
"allocation_start": "192.0.2.2",
"name": "ctlplane",
"name": "public",
"physical_network": "ctlplane",
"segmentation_id": 25
}
}
This creates a Neutron datacentre 'net' using VLAN tag 25, with the same
details as the flat network created above.
This creates a Neutron 'net' called ``public`` using VLAN tag 25, that uses
the existing 'net' called ``ctlplane`` as a physical transport.
.. note::
The key ``physical_network`` is required when creating a network that
specifies a ``segmentation_id``, and it must reference an existing net.
setup-neutron can also create two networks suitable for workload clouds::

View File

@ -88,9 +88,10 @@ def _create_net(neutron, network_desc, network_type, admin_tenant):
network['router:external'] = True
if type_desc.get('segmentation_id'):
vlan_tag = type_desc['segmentation_id']
physical_network = type_desc['physical_network']
network.update({'provider:network_type': 'vlan',
'provider:segmentation_id': vlan_tag,
'provider:physical_network': 'datacentre'})
'provider:physical_network': physical_network})
return neutron.create_network({'network': network})

View File

@ -41,12 +41,14 @@ class NeutronTest(base.TestCase):
def test_create_net_physical_vlan_tag(self):
client = mock.MagicMock()
network = {'physical': {'name': 'ctlplane', 'segmentation_id': '123'}}
network = {'physical': {'name': 'public',
'segmentation_id': '123',
'physical_network': 'ctlplane'}}
neutron._create_net(client, network, 'physical', 'admin_tenant')
physical_call = {'network': {'tenant_id': 'admin_tenant',
'provider:network_type': 'vlan',
'name': 'ctlplane',
'provider:physical_network': 'datacentre',
'name': 'public',
'provider:physical_network': 'ctlplane',
'provider:segmentation_id': '123',
'admin_state_up': True}}
client.create_network.assert_called_once_with(physical_call)