• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python _i18n._LE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中networking_sfc._i18n._LE函数的典型用法代码示例。如果您正苦于以下问题:Python _LE函数的具体用法?Python _LE怎么用?Python _LE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _parse_flow_classifier

    def _parse_flow_classifier(self, flow_classifier):
        dl_type, nw_proto, source_port_masks, destination_port_masks = (
            (None, ) * 4)

        if (
            not flow_classifier['source_port_range_min'] and
            not flow_classifier['source_port_range_max']
        ):
            # wildcard
            source_port_masks = ['0/0x0']
        elif not flow_classifier['source_port_range_min']:
            source_port_masks = ovs_ext_lib.get_port_mask(
                1,
                flow_classifier['source_port_range_max'])
        elif not flow_classifier['source_port_range_max']:
            source_port_masks = ovs_ext_lib.get_port_mask(
                flow_classifier['source_port_range_min'],
                65535)
        else:
            source_port_masks = ovs_ext_lib.get_port_mask(
                flow_classifier['source_port_range_min'],
                flow_classifier['source_port_range_max'])

        if (
            not flow_classifier['destination_port_range_min'] and
            not flow_classifier['destination_port_range_max']
        ):
            # wildcard
            destination_port_masks = ['0/0x0']
        elif not flow_classifier['destination_port_range_min']:
            destination_port_masks = ovs_ext_lib.get_port_mask(
                1,
                flow_classifier['destination_port_range_max'])
        elif not flow_classifier['destination_port_range_max']:
            destination_port_masks = ovs_ext_lib.get_port_mask(
                flow_classifier['destination_port_range_min'],
                65535)
        else:
            destination_port_masks = ovs_ext_lib.get_port_mask(
                flow_classifier['destination_port_range_min'],
                flow_classifier['destination_port_range_max'])

        if "IPv4" == flow_classifier['ethertype']:
            dl_type = 0x0800
            if n_consts.PROTO_NAME_TCP == flow_classifier['protocol']:
                nw_proto = n_consts.PROTO_NUM_TCP
            elif n_consts.PROTO_NAME_UDP == flow_classifier['protocol']:
                nw_proto = n_consts.PROTO_NUM_UDP
            elif n_consts.PROTO_NAME_ICMP == flow_classifier['protocol']:
                nw_proto = n_consts.PROTO_NUM_ICMP
            else:
                nw_proto = None
        elif "IPv6" == flow_classifier['ethertype']:
            LOG.error(_LE("Current portchain agent don't support Ipv6"))
        else:
            LOG.error(_LE("invalid protocol input"))
        return (dl_type, nw_proto,
                source_port_masks, destination_port_masks
                )
开发者ID:igordcard,项目名称:networking-sfc,代码行数:59,代码来源:sfc_driver.py


示例2: get_all_src_node_flowrules

    def get_all_src_node_flowrules(self, context):
        sfc_plugin = (
            manager.NeutronManager.get_service_plugins().get(
                sfc.SFC_EXT
            )
        )
        if not sfc_plugin:
            return []
        try:
            frs = []
            port_chains = sfc_plugin.get_port_chains(context)

            for port_chain in port_chains:
                # get the first node of this chain
                node_filters = dict(portchain_id=port_chain['id'], nsi=0xff)
                portchain_node = self.get_path_node_by_filter(node_filters)
                if not portchain_node:
                    continue
                flow_rule = self._get_portchain_src_node_flowrule(
                    portchain_node,
                    port_chain['flow_classifiers']
                )
                if not flow_rule:
                    continue
                frs.append(flow_rule)
            return frs
        except Exception as e:
            LOG.exception(e)
            LOG.error(_LE("get_all_src_node_flowrules failed"))
开发者ID:n-mohan,项目名称:networking-sfc,代码行数:29,代码来源:driver.py


示例3: update_flowrule_status

 def update_flowrule_status(self, context, id, status):
     try:
         flowrule_status = dict(status=status)
         self.update_path_node(id, flowrule_status)
     except Exception as e:
         LOG.exception(e)
         LOG.error(_LE("update_flowrule_status failed"))
开发者ID:n-mohan,项目名称:networking-sfc,代码行数:7,代码来源:driver.py


示例4: main

def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    q_utils.log_opt_values(LOG)
    bridge_classes = {
        'br_int': br_int.OVSIntegrationBridge,
        'br_phys': br_phys.OVSPhysicalBridge,
        'br_tun': br_tun.OVSTunnelBridge,
    }

    ovs_neutron_agent.prepare_xen_compute()
    ovs_neutron_agent.validate_tunnel_config(
        cfg.CONF.AGENT.tunnel_types,
        cfg.CONF.OVS.local_ip
    )

    try:
        agent = OVSSfcAgent(bridge_classes, cfg.CONF)
    except (RuntimeError, ValueError) as e:
        LOG.exception(e)
        LOG.error(_LE('Agent terminated!'))
        sys.exit(1)

    LOG.info(_LI("Agent initialized successfully, now running... "))
    agent.daemon_loop()
开发者ID:doonhammer,项目名称:networking-sfc,代码行数:25,代码来源:agent.py


示例5: handle_port

    def handle_port(self, context, port):
        """Handle agent SFC extension port add/update."""
        port_id = port['port_id']
        resync = False
        flowrule_status = []
        try:
            LOG.debug("a new device %s is found", port_id)
            flows_list = (
                self.sfc_plugin_rpc.get_flowrules_by_host_portid(
                    context, port_id
                )
            )
            if flows_list:
                for flow in flows_list:
                    self.sfc_driver.update_flow_rules(
                        flow, flowrule_status)
        except Exception as e:
            LOG.exception(e)
            LOG.error(_LE("SFC L2 extension handle_port failed"))
            resync = True

        if flowrule_status:
            self.sfc_plugin_rpc.update_flowrules_status(
                context, flowrule_status)

        return resync
开发者ID:igordcard,项目名称:networking-sfc,代码行数:26,代码来源:sfc.py


示例6: _call_drivers

    def _call_drivers(self, method_name, context, raise_orig_exc=False):
        """Helper method for calling a method across all drivers.

        :param method_name: name of the method to call
        :param context: context parameter to pass to each method call
        :param raise_orig_exc: whether or not to raise the original
        driver exception, or use a general one
        """
        for driver in self.ordered_drivers:
            try:
                getattr(driver.obj, method_name)(context)
            except Exception as e:
                # This is an internal failure.
                LOG.exception(e)
                LOG.error(
                    _LE("Flow Classifier driver '%(name)s' "
                        "failed in %(method)s"),
                    {'name': driver.name, 'method': method_name}
                )
                if raise_orig_exc:
                    raise
                else:
                    raise fc_exc.FlowClassifierDriverError(
                        method=method_name
                    )
开发者ID:igordcard,项目名称:networking-sfc,代码行数:25,代码来源:driver_manager.py


示例7: update_port_pair_group

    def update_port_pair_group(
        self, context, portpairgroup_id, port_pair_group
    ):
        with context.session.begin(subtransactions=True):
            original_portpairgroup = self.get_port_pair_group(
                context, portpairgroup_id)
            updated_portpairgroup = super(
                SfcPlugin, self).update_port_pair_group(
                context, portpairgroup_id, port_pair_group)
            portpairgroup_context = sfc_ctx.PortPairGroupContext(
                self, context, updated_portpairgroup,
                original_portpairgroup=original_portpairgroup)
            self.driver_manager.update_port_pair_group_precommit(
                portpairgroup_context)
        try:
            self.driver_manager.update_port_pair_group_postcommit(
                portpairgroup_context)
        except sfc_exc.SfcDriverError as e:
            LOG.exception(e)
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Update port pair group failed, "
                              "port_pair_group '%s'"),
                          updated_portpairgroup['id'])

        return updated_portpairgroup
开发者ID:igordcard,项目名称:networking-sfc,代码行数:25,代码来源:plugin.py


示例8: get_flowrules_by_host_portid

    def get_flowrules_by_host_portid(self, context, host, port_id):
        port_chain_flowrules = []
        sfc_plugin = directory.get_plugin(sfc.SFC_EXT)
        if not sfc_plugin:
            return port_chain_flowrules
        try:
            port_detail_list = []
            # one port only may be in egress/ingress port once time.
            ingress_port = self.get_port_detail_by_filter(
                dict(ingress=port_id))
            egress_port = self.get_port_detail_by_filter(
                dict(egress=port_id))
            if not ingress_port and not egress_port:
                return None
            # SF migrate to other host
            if ingress_port:
                port_detail_list.append(ingress_port)
                if ingress_port['host_id'] != host:
                    ingress_port.update(dict(host_id=host))

            if egress_port:
                port_detail_list.append(egress_port)
                if egress_port['host_id'] != host:
                    egress_port.update(dict(host_id=host))

            # this is a SF if there are both egress and engress.
            for i, ports in enumerate(port_detail_list):
                nodes_assocs = ports['path_nodes']
                for assoc in nodes_assocs:
                    # update current path flow rule
                    node = self.get_path_node(assoc['pathnode_id'])
                    port_chain = sfc_plugin.get_port_chain(
                        context,
                        node['portchain_id'])
                    flow_rule = self._build_portchain_flowrule_body(
                        node,
                        ports,
                        add_fc_ids=port_chain['flow_classifiers']
                    )
                    port_chain_flowrules.append(flow_rule)

                    # update the pre-path node flow rule
                    # if node['node_type'] != ovs_const.SRC_NODE:
                    #    node_filter = dict(nsp=node['nsp'],
                    #                       nsi=node['nsi'] + 1
                    #                       )
                    #    pre_node_list = self.get_path_nodes_by_filter(
                    #        node_filter)
                    #    if not pre_node_list:
                    #        continue
                    #    for pre_node in pre_node_list:
                    #        self._update_path_node_flowrules(
                    #            pre_node,
                    #            add_fc_ids=port_chain['flow_classifiers'])

            return port_chain_flowrules

        except Exception as e:
            LOG.exception(e)
            LOG.error(_LE("get_flowrules_by_host_portid failed"))
开发者ID:igordcard,项目名称:networking-sfc,代码行数:60,代码来源:driver.py


示例9: delete_port_chain

 def delete_port_chain(self, context, portchain_id):
     pc = self.get_port_chain(context, portchain_id)
     pc_context = sfc_ctx.PortChainContext(self, context, pc)
     try:
         self.driver_manager.delete_port_chain(pc_context)
     except sfc_exc.SfcDriverError as e:
         LOG.exception(e)
         with excutils.save_and_reraise_exception():
             LOG.error(_LE("Delete port chain failed, portchain '%s'"),
                       portchain_id)
     # TODO(qijing): unsync in case deleted in driver but fail in database
     super(SfcPlugin, self).delete_port_chain(context, portchain_id)
开发者ID:JunoZhu,项目名称:networking-sfc,代码行数:12,代码来源:plugin.py


示例10: delete_port_pair

    def delete_port_pair(self, context, portpair_id):
        portpair = self.get_port_pair(context, portpair_id)
        portpair_context = sfc_ctx.PortPairContext(
            self, context, portpair)
        try:
            self.driver_manager.delete_port_pair(portpair_context)
        except sfc_exc.SfcDriverError as e:
            LOG.exception(e)
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Delete port pair failed, port_pair '%s'"),
                          portpair_id)

        super(SfcPlugin, self).delete_port_pair(context, portpair_id)
开发者ID:JunoZhu,项目名称:networking-sfc,代码行数:13,代码来源:plugin.py


示例11: run_ofctl

 def run_ofctl(self, cmd, args, process_input=None):
     # We need to dump-groups according to group Id,
     # which is a feature of OpenFlow1.5
     full_args = [
         "ovs-ofctl", "-O openflow13", cmd, self.br_name
     ] + args
     try:
         return utils.execute(full_args, run_as_root=True,
                              process_input=process_input)
     except Exception as e:
         LOG.exception(e)
         LOG.error(_LE("Unable to execute %(args)s."),
                   {'args': full_args})
开发者ID:JunoZhu,项目名称:networking-sfc,代码行数:13,代码来源:ovs_ext_lib.py


示例12: delete_flow_classifier

    def delete_flow_classifier(self, context, fc_id):
        fc = self.get_flow_classifier(context, fc_id)
        fc_context = fc_ctx.FlowClassifierContext(self, context, fc)
        try:
            self.driver_manager.delete_flow_classifier(fc_context)
        except fc_exc.FlowClassfierDriverError as e:
            LOG.exception(e)
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Delete port pair group failed, "
                              "flow_classifier '%s'"),
                          fc_id)

        super(FlowClassifierPlugin, self).delete_flow_classifier(
            context, fc_id)
开发者ID:n-mohan,项目名称:networking-sfc,代码行数:14,代码来源:plugin.py


示例13: delete_flow_rules

    def delete_flow_rules(self, context, **kwargs):
        flowrule_status = []
        try:
            flowrules = kwargs['flowrule_entries']
            LOG.debug("delete_flow_rules received,  flowrules= %s", flowrules)
            if flowrules:
                self.sfc_driver.delete_flow_rule(
                    flowrules, flowrule_status)
        except Exception as e:
            LOG.exception(e)
            LOG.error(_LE("delete_flow_rules failed"))

        if flowrule_status:
            self.sfc_plugin_rpc.update_flowrules_status(
                context, flowrule_status)
开发者ID:igordcard,项目名称:networking-sfc,代码行数:15,代码来源:sfc.py


示例14: sfc_treat_devices_removed

    def sfc_treat_devices_removed(self, port_ids):
        resync = False
        for port_id in port_ids:
            LOG.info(_LI("a device %s is removed"), port_id)
            try:
                self._delete_ports_flowrules_by_id(port_id)
            except Exception as e:
                LOG.exception(e)
                LOG.error(
                    _LE("delete port flow rule failed for %(port_id)s"),
                    {'port_id': port_id}
                )
                resync = True

        return resync
开发者ID:doonhammer,项目名称:networking-sfc,代码行数:15,代码来源:agent.py


示例15: create_port_pair

    def create_port_pair(self, context, port_pair):
        portpair_db = super(SfcPlugin, self).create_port_pair(
            context, port_pair)
        portpair_context = sfc_ctx.PortPairContext(
            self, context, portpair_db)
        try:
            self.driver_manager.create_port_pair(portpair_context)
        except sfc_exc.SfcDriverError as e:
            LOG.exception(e)
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Create port pair failed, "
                              "deleting port_pair '%s'"),
                          portpair_db['id'])
                self.delete_port_pair(context, portpair_db['id'])

        return portpair_db
开发者ID:JunoZhu,项目名称:networking-sfc,代码行数:16,代码来源:plugin.py


示例16: update_port_pair

    def update_port_pair(self, context, portpair_id, port_pair):
        original_portpair = self.get_port_pair(context, portpair_id)
        updated_portpair = super(SfcPlugin, self).update_port_pair(
            context, portpair_id, port_pair)
        portpair_context = sfc_ctx.PortPairContext(
            self, context, updated_portpair,
            original_portpair=original_portpair)
        try:
            self.driver_manager.update_port_pair(portpair_context)
        except sfc_exc.SfcDriverError as e:
            LOG.exception(e)
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Update port pair failed, port_pair '%s'"),
                          updated_portpair['id'])

        return updated_portpair
开发者ID:JunoZhu,项目名称:networking-sfc,代码行数:16,代码来源:plugin.py


示例17: delete_port

    def delete_port(self, context, port):
        """Handle agent SFC extension port delete."""
        port_id = port['port_id']
        resync = False
        LOG.info(_LI("a device %s is removed"), port_id)
        try:
            self._delete_ports_flowrules_by_id(context, port_id)
        except Exception as e:
            LOG.exception(e)
            LOG.error(
                _LE("delete port flow rule failed for %(port_id)s"),
                {'port_id': port_id}
            )
            resync = True

        return resync
开发者ID:igordcard,项目名称:networking-sfc,代码行数:16,代码来源:sfc.py


示例18: create_flow_classifier

    def create_flow_classifier(self, context, flow_classifier):
        with context.session.begin(subtransactions=True):
            fc_db = super(FlowClassifierPlugin, self).create_flow_classifier(
                context, flow_classifier)
            fc_db_context = fc_ctx.FlowClassifierContext(self, context, fc_db)
            self.driver_manager.create_flow_classifier_precommit(
                fc_db_context)

        try:
            self.driver_manager.create_flow_classifier(fc_db_context)
        except fc_exc.FlowClassifierDriverError as e:
            LOG.exception(e)
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Create flow classifier failed, "
                              "deleting flow_classifier '%s'"),
                          fc_db['id'])
                self.delete_flow_classifier(context, fc_db['id'])
        return fc_db
开发者ID:n-mohan,项目名称:networking-sfc,代码行数:18,代码来源:plugin.py


示例19: update_flow_rules

    def update_flow_rules(self, flowrule, flowrule_status):
        try:
            if flowrule.get('egress', None):
                self._setup_egress_flow_rules(flowrule)
            if flowrule.get('ingress', None):
                self._setup_ingress_flow_rules_with_mpls(flowrule)

            flowrule_status_temp = {}
            flowrule_status_temp['id'] = flowrule['id']
            flowrule_status_temp['status'] = constants.STATUS_ACTIVE
            flowrule_status.append(flowrule_status_temp)
        except Exception as e:
            flowrule_status_temp = {}
            flowrule_status_temp['id'] = flowrule['id']
            flowrule_status_temp['status'] = constants.STATUS_ERROR
            flowrule_status.append(flowrule_status_temp)
            LOG.exception(e)
            LOG.error(_LE("update_flow_rules failed"))
开发者ID:igordcard,项目名称:networking-sfc,代码行数:18,代码来源:sfc_driver.py


示例20: update_port_chain

    def update_port_chain(self, context, portchain_id, port_chain):
        original_portchain = self.get_port_chain(context, portchain_id)
        updated_portchain = super(SfcPlugin, self).update_port_chain(
            context, portchain_id, port_chain)
        portchain_db_context = sfc_ctx.PortChainContext(
            self, context, updated_portchain,
            original_portchain=original_portchain)

        try:
            self.driver_manager.update_port_chain(portchain_db_context)
        except sfc_exc.SfcDriverError as e:
            LOG.exception(e)
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Update port chain failed, port_chain '%s'"),
                          updated_portchain['id'])

        # TODO(qijing): should we rollback the database update here?
        return updated_portchain
开发者ID:JunoZhu,项目名称:networking-sfc,代码行数:18,代码来源:plugin.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python _i18n._LE函数代码示例发布时间:2022-05-27
下一篇:
Python utils.ovn_name函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap