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


Python resources.ROUTER_INTERFACE屬性代碼示例

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


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

示例1: subscribe

# 需要導入模塊: from neutron_lib.callbacks import resources [as 別名]
# 或者: from neutron_lib.callbacks.resources import ROUTER_INTERFACE [as 別名]
def subscribe():
    registry.subscribe(
        vpn_router_gateway_callback, resources.ROUTER_GATEWAY,
        events.BEFORE_DELETE)
    registry.subscribe(
        vpn_router_gateway_callback, resources.ROUTER_INTERFACE,
        events.BEFORE_DELETE)
    registry.subscribe(
        migration_callback, resources.ROUTER, events.BEFORE_UPDATE)
    registry.subscribe(
        subnet_callback, resources.SUBNET, events.BEFORE_DELETE)


# NOTE(armax): multiple VPN service plugins (potentially out of tree) may
# inherit from vpn_db and may need the callbacks to be processed. Having an
# implicit subscription (through the module import) preserves the existing
# behavior, and at the same time it avoids fixing it manually in each and
# every vpn plugin outta there. That said, The subscription is also made
# explicitly in the reference vpn plugin. The subscription operation is
# idempotent so there is no harm in registering the same callback multiple
# times. 
開發者ID:openstack,項目名稱:neutron-vpnaas,代碼行數:23,代碼來源:vpn_db.py

示例2: _register_callbacks

# 需要導入模塊: from neutron_lib.callbacks import resources [as 別名]
# 或者: from neutron_lib.callbacks.resources import ROUTER_INTERFACE [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

示例3: test__register_callbacks

# 需要導入模塊: from neutron_lib.callbacks import resources [as 別名]
# 或者: from neutron_lib.callbacks.resources import ROUTER_INTERFACE [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 resources [as 別名]
# 或者: from neutron_lib.callbacks.resources import ROUTER_INTERFACE [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: vpn_router_gateway_callback

# 需要導入模塊: from neutron_lib.callbacks import resources [as 別名]
# 或者: from neutron_lib.callbacks.resources import ROUTER_INTERFACE [as 別名]
def vpn_router_gateway_callback(resource, event, trigger, payload=None):
    # the event payload objects
    vpn_plugin = directory.get_plugin(p_constants.VPN)
    if vpn_plugin:
        context = payload.context
        router_id = payload.resource_id
        if resource == resources.ROUTER_GATEWAY:
            vpn_plugin.check_router_in_use(context, router_id)
        elif resource == resources.ROUTER_INTERFACE:
            subnet_id = payload.metadata.get('subnet_id')
            vpn_plugin.check_subnet_in_use(context, subnet_id, router_id) 
開發者ID:openstack,項目名稱:neutron-vpnaas,代碼行數:13,代碼來源:vpn_db.py


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