diff --git a/vmware_nsx/plugins/nsx_v/drivers/abstract_router_driver.py b/vmware_nsx/plugins/nsx_v/drivers/abstract_router_driver.py index 6fe8ade8ae..e2760573e6 100644 --- a/vmware_nsx/plugins/nsx_v/drivers/abstract_router_driver.py +++ b/vmware_nsx/plugins/nsx_v/drivers/abstract_router_driver.py @@ -80,13 +80,15 @@ class RouterBaseDriver(RouterAbstractDriver): self._availability_zones = nsx_az.NsxVAvailabilityZones() def _notify_after_router_edge_association(self, context, router): - registry.notify(nsxv_constants.SERVICE_EDGE, events.AFTER_CREATE, - self, context=context, router=router) + registry.publish(nsxv_constants.SERVICE_EDGE, events.AFTER_CREATE, + self, payload=events.DBEventPayload( + context, states=(router,))) def _notify_before_router_edge_association(self, context, router, edge_id=None): - registry.notify(nsxv_constants.SERVICE_EDGE, events.BEFORE_DELETE, - self, context=context, router=router, edge_id=edge_id) + registry.publish(nsxv_constants.SERVICE_EDGE, events.BEFORE_DELETE, + self, payload=events.DBEventPayload( + context, states=(router,), resource_id=edge_id)) def _get_external_network_id_by_router(self, context, router_id): """Get router's external network id if it has.""" diff --git a/vmware_nsx/services/dynamic_routing/bgp_plugin.py b/vmware_nsx/services/dynamic_routing/bgp_plugin.py index 01ead01a2b..2fd0a160ab 100644 --- a/vmware_nsx/services/dynamic_routing/bgp_plugin.py +++ b/vmware_nsx/services/dynamic_routing/bgp_plugin.py @@ -328,12 +328,12 @@ class NSXBgpPlugin(service_base.ServicePluginBase, bgp_db.BgpDbMixin): context, speaker, router, updated_port) def _before_service_edge_delete_callback(self, resource, event, - trigger, **kwargs): - context = kwargs['context'].elevated() - router = kwargs['router'] + trigger, payload=None): + context = payload.context.elevated() + router = payload.latest_state ext_net_id = router.gw_port and router.gw_port['network_id'] gw_ip = router.gw_port and router.gw_port['fixed_ips'][0]['ip_address'] - edge_id = kwargs.get('edge_id') + edge_id = payload.resource_id speakers = self._bgp_speakers_for_gateway_network(context, ext_net_id) for speaker in speakers: driver = self._get_driver_by_project( @@ -347,9 +347,9 @@ class NSXBgpPlugin(service_base.ServicePluginBase, bgp_db.BgpDbMixin): gw_ip, edge_id) def _after_service_edge_create_callback(self, resource, event, - trigger, **kwargs): - context = kwargs['context'].elevated() - router = kwargs['router'] + trigger, payload=None): + context = payload.context.elevated() + router = payload.latest_state ext_net_id = router.gw_port and router.gw_port['network_id'] speakers = self._bgp_speakers_for_gateway_network(context, ext_net_id) for speaker in speakers: