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'),
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']
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:
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()