Merge "Fix so external_net_interface defines in .ini file are used"

This commit is contained in:
Jenkins 2016-03-03 13:43:18 +00:00 committed by Gerrit Code Review
commit e242d5d78c
2 changed files with 6 additions and 9 deletions

View File

@ -26,6 +26,8 @@ import networking_cisco.plugins.cisco.device_manager.plugging_drivers as plug
LOG = logging.getLogger(__name__)
DEVICE_OWNER_ROUTER_GW = l3_constants.DEVICE_OWNER_ROUTER_GW
class HwVLANTrunkingPlugDriver(plug.PluginSidePluggingDriver):
"""Driver class for Cisco hardware-based devices.
@ -67,8 +69,7 @@ class HwVLANTrunkingPlugDriver(plug.PluginSidePluggingDriver):
def extend_hosting_port_info(self, context, port_db, hosting_device,
hosting_info):
hosting_info['segmentation_id'] = port_db.hosting_info.segmentation_id
is_external = port_db.get('router_port', {}).get(
'port_type') == l3_constants.DEVICE_OWNER_ROUTER_GW
is_external = (port_db.device_owner == DEVICE_OWNER_ROUTER_GW)
hosting_info['physical_interface'] = self._get_interface_info(
hosting_device['id'], port_db.network_id, is_external)

View File

@ -148,9 +148,7 @@ class TestHwVLANTrunkingPlugDriver(
fake_port_db_obj = mock.MagicMock()
fake_port_db_obj.hosting_info = mock.MagicMock()
fake_port_db_obj.hosting_info.segmentation_id = 50
fake_port_db_obj.get = mock.MagicMock()
fake_port_db_obj.get.return_value = {
'port_type': l3_constants.DEVICE_OWNER_ROUTER_INTF}
fake_port_db_obj.device_owner = l3_constants.DEVICE_OWNER_ROUTER_INTF
hosting_device = {'id': '00000000-0000-0000-0000-000000000002'}
tenant_id = 'tenant_uuid1'
ctx = context.Context('', tenant_id, is_admin=True)
@ -166,9 +164,7 @@ class TestHwVLANTrunkingPlugDriver(
fake_port_db_obj = mock.MagicMock()
fake_port_db_obj.hosting_info = mock.MagicMock()
fake_port_db_obj.hosting_info.segmentation_id = 40
fake_port_db_obj.router_port = mock.MagicMock()
fake_port_db_obj.router_port.return_value = {
'port_type': l3_constants.DEVICE_OWNER_ROUTER_GW}
fake_port_db_obj.device_owner = l3_constants.DEVICE_OWNER_ROUTER_GW
hosting_device = {'id': '00000000-0000-0000-0000-000000000002'}
tenant_id = 'tenant_uuid1'
ctx = context.Context('', tenant_id, is_admin=True)
@ -176,7 +172,7 @@ class TestHwVLANTrunkingPlugDriver(
plugging_driver.extend_hosting_port_info(ctx, fake_port_db_obj,
hosting_device, hosting_info)
self.assertEqual(hosting_info['physical_interface'],
'GigabitEthernet/1/0/1')
'GigabitEthernet/2/0/1')
self.assertEqual(hosting_info['segmentation_id'], 40)
def _update_provider_net_info(self, res_list, fields):