Merge "Add expected IDs to router.interface.* notifications"
This commit is contained in:
commit
3ecda92448
@ -365,7 +365,9 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
context, routers, 'add_router_interface',
|
||||
{'network_id': port['network_id'],
|
||||
'subnet_id': subnet_id})
|
||||
info = {'port_id': port['id'],
|
||||
info = {'id': router_id,
|
||||
'tenant_id': subnet['tenant_id'],
|
||||
'port_id': port['id'],
|
||||
'subnet_id': port['fixed_ips'][0]['subnet_id']}
|
||||
notifier_api.notify(context,
|
||||
notifier_api.publisher_id('network'),
|
||||
@ -402,6 +404,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
port_id=port_id,
|
||||
subnet_id=interface_info['subnet_id'])
|
||||
subnet_id = port_db['fixed_ips'][0]['subnet_id']
|
||||
subnet = self._get_subnet(context, subnet_id)
|
||||
self._confirm_router_interface_not_in_use(
|
||||
context, router_id, subnet_id)
|
||||
_network_id = port_db['network_id']
|
||||
@ -439,13 +442,15 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
context, routers, 'remove_router_interface',
|
||||
{'network_id': _network_id,
|
||||
'subnet_id': subnet_id})
|
||||
info = {'id': router_id,
|
||||
'tenant_id': subnet['tenant_id'],
|
||||
'port_id': port_id,
|
||||
'subnet_id': subnet_id}
|
||||
notifier_api.notify(context,
|
||||
notifier_api.publisher_id('network'),
|
||||
'router.interface.delete',
|
||||
notifier_api.CONF.default_notification_level,
|
||||
{'router.interface':
|
||||
{'port_id': port_id,
|
||||
'subnet_id': subnet_id}})
|
||||
{'router.interface': info})
|
||||
|
||||
def _get_floatingip(self, context, id):
|
||||
try:
|
||||
|
@ -669,6 +669,18 @@ class L3NatDBTestCase(L3NatTestCaseBase):
|
||||
set(n['event_type'] for n in test_notifier.NOTIFICATIONS),
|
||||
set(exp_notifications))
|
||||
|
||||
for n in test_notifier.NOTIFICATIONS:
|
||||
if n['event_type'].startswith('router.interface.'):
|
||||
payload = n['payload']['router.interface']
|
||||
self.assertIn('id', payload)
|
||||
self.assertEquals(payload['id'], r['router']['id'])
|
||||
self.assertIn('tenant_id', payload)
|
||||
stid = s['subnet']['tenant_id']
|
||||
# tolerate subnet tenant deliberately to '' in the
|
||||
# nicira metadata access case
|
||||
self.assertTrue(payload['tenant_id'] == stid or
|
||||
payload['tenant_id'] == '')
|
||||
|
||||
def test_router_add_interface_subnet_with_bad_tenant_returns_404(self):
|
||||
with mock.patch('quantum.context.Context.to_dict') as tdict:
|
||||
tenant_id = _uuid()
|
||||
|
Loading…
x
Reference in New Issue
Block a user