Merge "Do not hardcode datacentre as the physical network"
This commit is contained in:
commit
3bf3346e7c
@ -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::
|
||||
|
||||
|
@ -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})
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user