本文整理汇总了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.
示例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)
示例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)
示例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)
示例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)