Merge "NSX: Fix fake_api_client to raise NotFound" into stable/icehouse
This commit is contained in:
commit
3432a67672
@ -381,6 +381,9 @@ class FakeClient:
|
|||||||
res_dict = getattr(self, '_fake_%s_dict' % resource_type)
|
res_dict = getattr(self, '_fake_%s_dict' % resource_type)
|
||||||
if parent_uuid == '*':
|
if parent_uuid == '*':
|
||||||
parent_uuid = None
|
parent_uuid = None
|
||||||
|
# NSX raises ResourceNotFound if lswitch doesn't exist and is not *
|
||||||
|
elif not res_dict and resource_type == self.LSWITCH_LPORT_RESOURCE:
|
||||||
|
raise api_exc.ResourceNotFound()
|
||||||
|
|
||||||
def _attr_match(res_uuid):
|
def _attr_match(res_uuid):
|
||||||
if not attr_filter:
|
if not attr_filter:
|
||||||
|
@ -183,7 +183,7 @@ class LogicalPortsTestCase(base.NsxlibTestCase):
|
|||||||
self.assertIsNotNone(lport2)
|
self.assertIsNotNone(lport2)
|
||||||
self.assertEqual(lport['uuid'], lport2['uuid'])
|
self.assertEqual(lport['uuid'], lport2['uuid'])
|
||||||
|
|
||||||
def test_get_port_by_tag_not_found_returns_None(self):
|
def test_get_port_by_tag_not_found_with_switch_id_raises_not_found(self):
|
||||||
tenant_id = 'pippo'
|
tenant_id = 'pippo'
|
||||||
neutron_port_id = 'whatever'
|
neutron_port_id = 'whatever'
|
||||||
transport_zones_config = [{'zone_uuid': _uuid(),
|
transport_zones_config = [{'zone_uuid': _uuid(),
|
||||||
@ -191,8 +191,21 @@ class LogicalPortsTestCase(base.NsxlibTestCase):
|
|||||||
lswitch = switchlib.create_lswitch(
|
lswitch = switchlib.create_lswitch(
|
||||||
self.fake_cluster, tenant_id, _uuid(),
|
self.fake_cluster, tenant_id, _uuid(),
|
||||||
'fake-switch', transport_zones_config)
|
'fake-switch', transport_zones_config)
|
||||||
|
self.assertRaises(exceptions.NotFound,
|
||||||
|
switchlib.get_port_by_neutron_tag,
|
||||||
|
self.fake_cluster, lswitch['uuid'],
|
||||||
|
neutron_port_id)
|
||||||
|
|
||||||
|
def test_get_port_by_tag_not_find_wildcard_lswitch_returns_none(self):
|
||||||
|
tenant_id = 'pippo'
|
||||||
|
neutron_port_id = 'whatever'
|
||||||
|
transport_zones_config = [{'zone_uuid': _uuid(),
|
||||||
|
'transport_type': 'stt'}]
|
||||||
|
switchlib.create_lswitch(
|
||||||
|
self.fake_cluster, tenant_id, _uuid(),
|
||||||
|
'fake-switch', transport_zones_config)
|
||||||
lport = switchlib.get_port_by_neutron_tag(
|
lport = switchlib.get_port_by_neutron_tag(
|
||||||
self.fake_cluster, lswitch['uuid'], neutron_port_id)
|
self.fake_cluster, '*', neutron_port_id)
|
||||||
self.assertIsNone(lport)
|
self.assertIsNone(lport)
|
||||||
|
|
||||||
def test_get_port_status(self):
|
def test_get_port_status(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user