Merge "[NSXv]: Add support for multiple transport zones"
This commit is contained in:
commit
929926e284
@ -1,2 +1 @@
|
|||||||
312211a5725f
|
|
||||||
3c88bdea3054
|
3c88bdea3054
|
@ -0,0 +1 @@
|
|||||||
|
2af850eb3970
|
@ -0,0 +1,43 @@
|
|||||||
|
# Copyright 2015 VMware, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
"""update nsxv tz binding type
|
||||||
|
|
||||||
|
Revision ID: 2af850eb3970
|
||||||
|
Revises: 312211a5725f
|
||||||
|
Create Date: 2015-11-24 13:44:08.664653
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '2af850eb3970'
|
||||||
|
down_revision = '312211a5725f'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
tz_binding_type_enum = sa.Enum('flat', 'vlan', 'portgroup',
|
||||||
|
name='nsxv_tz_network_bindings_binding_type')
|
||||||
|
new_tz_binding_type_enum = sa.Enum(
|
||||||
|
'flat', 'vlan', 'portgroup', 'vxlan',
|
||||||
|
name='nsxv_tz_network_bindings_binding_type')
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.alter_column(
|
||||||
|
'nsxv_tz_network_bindings',
|
||||||
|
'binding_type',
|
||||||
|
type_=new_tz_binding_type_enum,
|
||||||
|
existing_type=tz_binding_type_enum)
|
@ -177,7 +177,7 @@ class NsxvTzNetworkBinding(model_base.BASEV2):
|
|||||||
sa.ForeignKey('networks.id', ondelete="CASCADE"),
|
sa.ForeignKey('networks.id', ondelete="CASCADE"),
|
||||||
primary_key=True)
|
primary_key=True)
|
||||||
binding_type = sa.Column(
|
binding_type = sa.Column(
|
||||||
sa.Enum('flat', 'vlan', 'portgroup',
|
sa.Enum('flat', 'vlan', 'portgroup', 'vxlan',
|
||||||
name='nsxv_tz_network_bindings_binding_type'),
|
name='nsxv_tz_network_bindings_binding_type'),
|
||||||
nullable=False, primary_key=True)
|
nullable=False, primary_key=True)
|
||||||
phy_uuid = sa.Column(sa.String(36), primary_key=True, nullable=True)
|
phy_uuid = sa.Column(sa.String(36), primary_key=True, nullable=True)
|
||||||
|
@ -572,6 +572,8 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
attr.is_attr_set(external) and not external)
|
attr.is_attr_set(external) and not external)
|
||||||
if backend_network:
|
if backend_network:
|
||||||
network_type = None
|
network_type = None
|
||||||
|
#NOTE(abhiraut): Consider refactoring code below to have more
|
||||||
|
# readable conditions.
|
||||||
if provider_type is not None:
|
if provider_type is not None:
|
||||||
segment = net_data[mpnet.SEGMENTS][0]
|
segment = net_data[mpnet.SEGMENTS][0]
|
||||||
network_type = segment.get(pnet.NETWORK_TYPE)
|
network_type = segment.get(pnet.NETWORK_TYPE)
|
||||||
@ -581,7 +583,16 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
virtual_wire = {"name": net_data['id'],
|
virtual_wire = {"name": net_data['id'],
|
||||||
"tenantId": "virtual wire tenant"}
|
"tenantId": "virtual wire tenant"}
|
||||||
config_spec = {"virtualWireCreateSpec": virtual_wire}
|
config_spec = {"virtualWireCreateSpec": virtual_wire}
|
||||||
h, c = self.nsx_v.vcns.create_virtual_wire(self.vdn_scope_id,
|
vdn_scope_id = self.vdn_scope_id
|
||||||
|
if provider_type is not None:
|
||||||
|
segment = net_data[mpnet.SEGMENTS][0]
|
||||||
|
if attr.is_attr_set(segment.get(pnet.PHYSICAL_NETWORK)):
|
||||||
|
vdn_scope_id = segment.get(pnet.PHYSICAL_NETWORK)
|
||||||
|
if not (self.nsx_v.vcns.
|
||||||
|
validate_vdn_scope(vdn_scope_id)):
|
||||||
|
error = _("Configured vdn_scope_id not found")
|
||||||
|
raise nsx_exc.NsxPluginException(err_msg=error)
|
||||||
|
h, c = self.nsx_v.vcns.create_virtual_wire(vdn_scope_id,
|
||||||
config_spec)
|
config_spec)
|
||||||
net_moref = c
|
net_moref = c
|
||||||
elif network_type == c_utils.NsxVNetworkTypes.PORTGROUP:
|
elif network_type == c_utils.NsxVNetworkTypes.PORTGROUP:
|
||||||
|
@ -299,6 +299,21 @@ class TestNetworksV2(test_plugin.TestNetworksV2, NsxVPluginV2TestCase):
|
|||||||
for k, v in expected_same_vlan:
|
for k, v in expected_same_vlan:
|
||||||
self.assertEqual(net1['network'][k], v)
|
self.assertEqual(net1['network'][k], v)
|
||||||
|
|
||||||
|
def test_create_vxlan_with_tz_provider_network(self):
|
||||||
|
name = 'provider_net_vxlan'
|
||||||
|
expected = [('subnets', []), ('name', name), ('admin_state_up', True),
|
||||||
|
('status', 'ACTIVE'), ('shared', False),
|
||||||
|
(pnet.NETWORK_TYPE, 'vxlan'),
|
||||||
|
(pnet.PHYSICAL_NETWORK, 'vdnscope-2')]
|
||||||
|
providernet_args = {pnet.NETWORK_TYPE: 'vxlan',
|
||||||
|
pnet.PHYSICAL_NETWORK: 'vdnscope-2'}
|
||||||
|
with self.network(name=name,
|
||||||
|
providernet_args=providernet_args,
|
||||||
|
arg_list=(pnet.NETWORK_TYPE,
|
||||||
|
pnet.PHYSICAL_NETWORK)) as net:
|
||||||
|
for k, v in expected:
|
||||||
|
self.assertEqual(net['network'][k], v)
|
||||||
|
|
||||||
|
|
||||||
class TestVnicIndex(NsxVPluginV2TestCase,
|
class TestVnicIndex(NsxVPluginV2TestCase,
|
||||||
test_vnic_index.VnicIndexDbTestCase):
|
test_vnic_index.VnicIndexDbTestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user