当前位置: 首页>>代码示例>>Python>>正文


Python resources.ROUTER属性代码示例

本文整理汇总了Python中neutron_lib.callbacks.resources.ROUTER属性的典型用法代码示例。如果您正苦于以下问题:Python resources.ROUTER属性的具体用法?Python resources.ROUTER怎么用?Python resources.ROUTER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在neutron_lib.callbacks.resources的用法示例。


在下文中一共展示了resources.ROUTER属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: subscribe

# 需要导入模块: from neutron_lib.callbacks import resources [as 别名]
# 或者: from neutron_lib.callbacks.resources import ROUTER [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: _test_router_operation

# 需要导入模块: from neutron_lib.callbacks import resources [as 别名]
# 或者: from neutron_lib.callbacks.resources import ROUTER [as 别名]
def _test_router_operation(self, event, operation, router, ops=True):
        method = getattr(self.flavor_driver,
                         '_router_%s_%s' % (operation, event))
        if event == 'precommit':
            method(odl_const.ODL_ROUTER, mock.ANY, mock.ANY, **router)
        else:
            payload = events.DBEventPayload(
                router.get('context'), states=(router.get('router_db'),),
                request_body=router.get(resources.ROUTER),
                resource_id=router.get(resources.ROUTER).get('id'))

            method(odl_const.ODL_ROUTER, mock.ANY, mock.ANY, payload=payload)
        row = db.get_oldest_pending_db_row_with_lock(self.db_context)
        if ops:
            if operation in ['del', odl_const.ODL_DELETE]:
                self.assertEqual(router['router_id'], row.object_uuid)
            else:
                self.assertEqual(router['router'], row.data)
            self.assertEqual(_operation_map[operation], row.operation)
        else:
            self.assertIsNone(row) 
开发者ID:openstack,项目名称:networking-odl,代码行数:23,代码来源:test_l3_flavor.py

示例3: _gateway_router_device_callback

# 需要导入模块: from neutron_lib.callbacks import resources [as 别名]
# 或者: from neutron_lib.callbacks.resources import ROUTER [as 别名]
def _gateway_router_device_callback(self, resource, event,
                                        trigger, payload=None):
        # TODO(boden): refactor this back into _gateway_device_callback once
        # NETWORK resources use paylaods
        if resource == resources.ROUTER:
            resource_id = payload.resource_id
            gw_dev_type = gw_device_ext.ROUTER_DEVICE_TYPE
            resource_type = 'router'
        else:
            return
        context = payload.context
        if self._get_gateway_device_from_resource(context,
                                                  gw_dev_type,
                                                  resource_id):
            raise gw_device_ext.DeviceInUseByGatewayDevice(
                resource_id=resource_id, resource_type=resource_type) 
开发者ID:openstack,项目名称:networking-midonet,代码行数:18,代码来源:gateway_device.py

示例4: _check_router_not_in_use

# 需要导入模块: from neutron_lib.callbacks import resources [as 别名]
# 或者: from neutron_lib.callbacks.resources import ROUTER [as 别名]
def _check_router_not_in_use(self, context, router_id):
        try:
            registry.publish(
                resources.ROUTER, events.BEFORE_DELETE, self,
                payload=events.DBEventPayload(context, resource_id=router_id))
        except exceptions.CallbackFailure as e:
            with excutils.save_and_reraise_exception():
                if len(e.errors) == 1:
                    raise e.errors[0].error
                raise l3_exc.RouterInUse(router_id=router_id, reason=e) 
开发者ID:openstack,项目名称:networking-midonet,代码行数:12,代码来源:l3_db_midonet.py

示例5: _register_callbacks

# 需要导入模块: from neutron_lib.callbacks import resources [as 别名]
# 或者: from neutron_lib.callbacks.resources import ROUTER [as 别名]
def _register_callbacks(self):
        registry.subscribe(self.router_create_callback,
                           resources.ROUTER,
                           events.PRECOMMIT_CREATE)
        registry.subscribe(self._update_port_handler,
                           resources.PORT, events.AFTER_UPDATE) 
开发者ID:openstack,项目名称:dragonflow,代码行数:8,代码来源:l3_router_plugin.py

示例6: test_unsubscribe_all

# 需要导入模块: from neutron_lib.callbacks import resources [as 别名]
# 或者: from neutron_lib.callbacks.resources import ROUTER [as 别名]
def test_unsubscribe_all(self):
        self.manager.subscribe(
            callback_1, resources.PORT, events.BEFORE_CREATE)
        self.manager.subscribe(
            callback_1, resources.PORT, events.BEFORE_DELETE)
        self.manager.subscribe(
            callback_1, resources.ROUTER, events.BEFORE_CREATE)
        self.manager.unsubscribe_all(callback_1)
        self.assertNotIn(
            callback_id_1,
            self.manager._callbacks[resources.PORT][events.BEFORE_CREATE])
        self.assertNotIn(callback_id_1, self.manager._index) 
开发者ID:openstack,项目名称:neutron-lib,代码行数:14,代码来源:test_manager.py

示例7: test__notify_loop_multiple_events

# 需要导入模块: from neutron_lib.callbacks import resources [as 别名]
# 或者: from neutron_lib.callbacks.resources import ROUTER [as 别名]
def test__notify_loop_multiple_events(self):
        self.manager.subscribe(
            callback_1, resources.PORT, events.BEFORE_CREATE)
        self.manager.subscribe(
            callback_1, resources.ROUTER, events.BEFORE_DELETE)
        self.manager.subscribe(
            callback_2, resources.PORT, events.BEFORE_CREATE)
        self.manager._notify_loop(
            resources.PORT, events.BEFORE_CREATE, mock.ANY)
        self.manager._notify_loop(
            resources.ROUTER, events.BEFORE_DELETE, mock.ANY)
        self.assertEqual(2, callback_1.counter)
        self.assertEqual(1, callback_2.counter) 
开发者ID:openstack,项目名称:neutron-lib,代码行数:15,代码来源:test_manager.py


注:本文中的neutron_lib.callbacks.resources.ROUTER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。