當前位置: 首頁>>代碼示例>>Python>>正文


Python events.AFTER_DELETE屬性代碼示例

本文整理匯總了Python中neutron_lib.callbacks.events.AFTER_DELETE屬性的典型用法代碼示例。如果您正苦於以下問題:Python events.AFTER_DELETE屬性的具體用法?Python events.AFTER_DELETE怎麽用?Python events.AFTER_DELETE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在neutron_lib.callbacks.events的用法示例。


在下文中一共展示了events.AFTER_DELETE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _register_callbacks

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def _register_callbacks(self):
        registry.subscribe(self.floatingip_update_callback,
                           resources.FLOATING_IP,
                           events.AFTER_UPDATE)
        registry.subscribe(self.router_interface_callback,
                           resources.ROUTER_INTERFACE,
                           events.AFTER_CREATE)
        registry.subscribe(self.router_interface_callback,
                           resources.ROUTER_INTERFACE,
                           events.BEFORE_CREATE)
        registry.subscribe(self.router_interface_callback,
                           resources.ROUTER_INTERFACE,
                           events.AFTER_DELETE)
        registry.subscribe(self.router_gateway_callback,
                           resources.ROUTER_GATEWAY,
                           events.AFTER_CREATE)
        registry.subscribe(self.router_gateway_callback,
                           resources.ROUTER_GATEWAY,
                           events.AFTER_DELETE)
        registry.subscribe(self.port_callback,
                           resources.PORT,
                           events.AFTER_UPDATE) 
開發者ID:openstack,項目名稱:neutron-dynamic-routing,代碼行數:24,代碼來源:bgp_plugin.py

示例2: router_gateway_callback

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def router_gateway_callback(self, resource, event, trigger, payload=None):
        if event == events.AFTER_CREATE:
            self._handle_router_gateway_after_create(payload)
        if event == events.AFTER_DELETE:
            gw_network = payload.metadata.get('network_id')
            router_id = payload.resource_id
            next_hops = self._next_hops_from_gateway_ips(
                payload.metadata.get('gateway_ips'))
            ctx = context.get_admin_context()
            speakers = self._bgp_speakers_for_gateway_network(ctx, gw_network)
            for speaker in speakers:
                if speaker.ip_version in next_hops:
                    next_hop = next_hops[speaker.ip_version]
                    prefixes = self._tenant_prefixes_by_router(ctx,
                                                               router_id,
                                                               speaker.id)
                    routes = self._route_list_from_prefixes_and_next_hop(
                                                                     prefixes,
                                                                     next_hop)
                self._handle_router_interface_after_delete(gw_network, routes) 
開發者ID:openstack,項目名稱:neutron-dynamic-routing,代碼行數:22,代碼來源:bgp_plugin.py

示例3: test__register_callbacks

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def test__register_callbacks(self):
        with mock.patch.object(registry, 'subscribe') as subscribe:
            plugin = bgp_plugin.BgpPlugin()
            expected_calls = [
                mock.call(plugin.bgp_drscheduler.schedule_bgp_speaker_callback,
                          dr_resources.BGP_SPEAKER, events.AFTER_CREATE),
                mock.call(plugin.floatingip_update_callback,
                          resources.FLOATING_IP, events.AFTER_UPDATE),
                mock.call(plugin.router_interface_callback,
                          resources.ROUTER_INTERFACE, events.AFTER_CREATE),
                mock.call(plugin.router_interface_callback,
                          resources.ROUTER_INTERFACE, events.BEFORE_CREATE),
                mock.call(plugin.router_interface_callback,
                          resources.ROUTER_INTERFACE, events.AFTER_DELETE),
                mock.call(plugin.router_gateway_callback,
                          resources.ROUTER_GATEWAY, events.AFTER_CREATE),
                mock.call(plugin.router_gateway_callback,
                          resources.ROUTER_GATEWAY, events.AFTER_DELETE),
                mock.call(plugin.port_callback,
                          resources.PORT, events.AFTER_UPDATE),
            ]
            self.assertEqual(subscribe.call_args_list, expected_calls) 
開發者ID:openstack,項目名稱:neutron-dynamic-routing,代碼行數:24,代碼來源:test_bgp_plugin.py

示例4: _register_callbacks

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def _register_callbacks(self):
        registry.subscribe(self.floatingip_update_callback,
                           resources.FLOATING_IP,
                           events.AFTER_UPDATE)
        registry.subscribe(self.router_port_callback,
                           resources.ROUTER_INTERFACE,
                           events.AFTER_CREATE)
        registry.subscribe(self.router_port_callback,
                           resources.ROUTER_INTERFACE,
                           events.AFTER_DELETE)
        registry.subscribe(self.router_port_callback,
                           resources.ROUTER_GATEWAY,
                           events.AFTER_CREATE)
        registry.subscribe(self.router_port_callback,
                           resources.ROUTER_GATEWAY,
                           events.AFTER_DELETE) 
開發者ID:openstack,項目名稱:dragonflow,代碼行數:18,代碼來源:bgp_plugin.py

示例5: subscribe_registries

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def subscribe_registries(self):
        registry.subscribe(self.post_fork_initialize,
                           resources.PROCESS,
                           events.AFTER_INIT)

        registry.subscribe(self.update_security_group,
                           resources.SECURITY_GROUP,
                           events.AFTER_CREATE)
        registry.subscribe(self.update_security_group,
                           resources.SECURITY_GROUP,
                           events.AFTER_UPDATE)
        registry.subscribe(self.delete_security_group,
                           resources.SECURITY_GROUP,
                           events.BEFORE_DELETE)
        registry.subscribe(self.create_security_group_rule,
                           resources.SECURITY_GROUP_RULE,
                           events.AFTER_CREATE)
        registry.subscribe(self.delete_security_group_rule,
                           resources.SECURITY_GROUP_RULE,
                           events.AFTER_DELETE) 
開發者ID:openstack,項目名稱:dragonflow,代碼行數:22,代碼來源:mech_driver.py

示例6: test_decorated_inst_method_receives

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def test_decorated_inst_method_receives(self):
        i1 = ObjectWithDecoratedCallback()
        registry.notify(resources.PORT, events.BEFORE_CREATE, self)
        self.assertEqual(0, i1.counter)
        registry.notify(resources.PORT, events.AFTER_CREATE, self)
        self.assertEqual(1, i1.counter)
        registry.notify(resources.PORT, events.AFTER_UPDATE, self)
        self.assertEqual(2, i1.counter)
        registry.notify(resources.NETWORK, events.AFTER_UPDATE, self)
        self.assertEqual(2, i1.counter)
        registry.notify(resources.NETWORK, events.AFTER_DELETE, self)
        self.assertEqual(3, i1.counter)
        i2 = ObjectWithDecoratedCallback()
        self.assertEqual(0, i2.counter)
        registry.notify(resources.NETWORK, events.AFTER_DELETE, self)
        self.assertEqual(4, i1.counter)
        self.assertEqual(1, i2.counter) 
開發者ID:openstack,項目名稱:neutron-lib,代碼行數:19,代碼來源:test_registry.py

示例7: router_interface_callback

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def router_interface_callback(self, resource, event, trigger, **kwargs):
        if event == events.AFTER_CREATE:
            self._handle_router_interface_after_create(**kwargs)
        if event == events.AFTER_DELETE:
            gw_network = kwargs['network_id']
            next_hops = self._next_hops_from_gateway_ips(
                                                        kwargs['gateway_ips'])
            ctx = context.get_admin_context()
            speakers = self._bgp_speakers_for_gateway_network(ctx, gw_network)
            for speaker in speakers:
                routes = self._route_list_from_prefixes_and_next_hop(
                                                kwargs['cidrs'],
                                                next_hops[speaker.ip_version])
                self._handle_router_interface_after_delete(gw_network, routes) 
開發者ID:openstack,項目名稱:neutron-dynamic-routing,代碼行數:16,代碼來源:bgp_plugin.py

示例8: l2gw_callback

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def l2gw_callback(resource, event, trigger, **kwargs):
    l2gwservice = directory.get_plugin(constants.L2GW)
    context = kwargs.get('context')
    port_dict = kwargs.get('port')
    if l2gwservice:
        if event == events.AFTER_UPDATE:
            l2gwservice.add_port_mac(context, port_dict)
        elif event == events.AFTER_DELETE:
            l2gwservice.delete_port_mac(context, port_dict) 
開發者ID:openstack,項目名稱:networking-l2gw,代碼行數:11,代碼來源:l2gateway_db.py

示例9: subscribe

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def subscribe():
    interested_events = (events.AFTER_UPDATE,
                         events.AFTER_DELETE)
    for x in interested_events:
        registry.subscribe(
            l2gw_callback, resources.PORT, x) 
開發者ID:openstack,項目名稱:networking-l2gw,代碼行數:8,代碼來源:l2gateway_db.py

示例10: test_l2gw_callback_delete_port

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def test_l2gw_callback_delete_port(self):
        service_plugin = mock.Mock()
        directory.add_plugin(constants.L2GW, service_plugin)
        fake_context = mock.Mock()
        fake_port = mock.Mock()
        fake_kwargs = {'context': fake_context,
                       'port': fake_port}
        l2gateway_db.l2gw_callback(resources.PORT,
                                   events.AFTER_DELETE,
                                   mock.Mock(),
                                   **fake_kwargs)
        self.assertTrue(service_plugin.delete_port_mac.called) 
開發者ID:openstack,項目名稱:networking-l2gw,代碼行數:14,代碼來源:test_l2gw_db.py

示例11: trunk_subports_set_status

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def trunk_subports_set_status(self, resource, event, trunk_plugin,
                                  payload):
        core_plugin = directory.get_plugin()
        admin_context = context.get_admin_context()

        if event == events.AFTER_DELETE:
            status = n_const.PORT_STATUS_DOWN
        else:
            parent_id = payload.current_trunk.port_id
            parent_port = core_plugin._get_port(admin_context, parent_id)
            status = parent_port['status']

        for subport in payload.subports:
            self._set_subport_status(core_plugin, admin_context,
                                     subport.port_id, status) 
開發者ID:openstack,項目名稱:networking-odl,代碼行數:17,代碼來源:trunk_driver_v2.py

示例12: register

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def register(self, resource, event, trigger, payload=None):
        super(OpenDaylightTrunkDriverV2, self).register(
            resource, event, trigger, payload=payload)
        self._handler = OpenDaylightTrunkHandlerV2()
        registry.subscribe(self._handler.trunk_create_precommit,
                           resources.TRUNK, events.PRECOMMIT_CREATE)
        registry.subscribe(self._handler.trunk_create_postcommit,
                           resources.TRUNK, events.AFTER_CREATE)
        registry.subscribe(self._handler.trunk_update_precommit,
                           resources.TRUNK, events.PRECOMMIT_UPDATE)
        registry.subscribe(self._handler.trunk_update_postcommit,
                           resources.TRUNK, events.AFTER_UPDATE)
        registry.subscribe(self._handler.trunk_delete_precommit,
                           resources.TRUNK, events.PRECOMMIT_DELETE)
        registry.subscribe(self._handler.trunk_delete_postcommit,
                           resources.TRUNK, events.AFTER_DELETE)
        for event_ in (events.PRECOMMIT_CREATE, events.PRECOMMIT_DELETE):
            registry.subscribe(self._handler.trunk_update_precommit,
                               resources.SUBPORTS, event_)
        for event_ in (events.AFTER_CREATE, events.AFTER_DELETE):
            registry.subscribe(self._handler.trunk_update_postcommit,
                               resources.SUBPORTS, event_)
            # Upon subport creation/deletion we need to set the right port
            # status:
            # 1. Set it to parent status when it is attached to the trunk
            # 2. Set it to down when is removed from the trunk
            registry.subscribe(self._handler.trunk_subports_set_status,
                               resources.SUBPORTS, event_)
        # NOTE(ltomasbo): if the status of the parent port changes, the
        # subports need to update their status too
        registry.subscribe(self._handler.trunk_subports_update_status,
                           resources.PORT, events.AFTER_UPDATE) 
開發者ID:openstack,項目名稱:networking-odl,代碼行數:34,代碼來源:trunk_driver_v2.py

示例13: test_trunk_subports_set_status_delete

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def test_trunk_subports_set_status_delete(self, mock_set_subport_status):
        resource = resources.SUBPORTS
        event_type = events.AFTER_DELETE
        fake_payload = self._fake_trunk_payload()

        fake_payload.subports = [models.SubPort(port_id='fake_port_id',
                                                segmentation_id=101,
                                                segmentation_type='vlan',
                                                trunk_id='fake_id')]

        self.handler.trunk_subports_set_status(resource, event_type, mock.ANY,
                                               fake_payload)
        mock_set_subport_status.assert_called_once_with(
            mock.ANY, mock.ANY, 'fake_port_id', n_const.PORT_STATUS_DOWN) 
開發者ID:openstack,項目名稱:networking-odl,代碼行數:16,代碼來源:test_trunk_driver_v2.py

示例14: test_callback_postcommit_sg_delete

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def test_callback_postcommit_sg_delete(self):
        self._test_callback_postcommit_for_sg(
            events.AFTER_DELETE, odl_const.ODL_DELETE, None, FAKE_ID) 
開發者ID:openstack,項目名稱:networking-odl,代碼行數:5,代碼來源:test_callback.py

示例15: test_callback_postcommit_sg_rules_delete

# 需要導入模塊: from neutron_lib.callbacks import events [as 別名]
# 或者: from neutron_lib.callbacks.events import AFTER_DELETE [as 別名]
def test_callback_postcommit_sg_rules_delete(self):
        self._test_callback_postcommit_for_sg_rules(
            events.AFTER_DELETE, odl_const.ODL_DELETE, None, FAKE_ID) 
開發者ID:openstack,項目名稱:networking-odl,代碼行數:5,代碼來源:test_callback.py


注:本文中的neutron_lib.callbacks.events.AFTER_DELETE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。