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


Python _i18n._LI函数代码示例

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


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

示例1: dfa_uplink_restart

 def dfa_uplink_restart(self, uplink_dict):
     LOG.info(_LI("Obtained uplink after restart %s "), uplink_dict)
     # This shouldn't happen
     if self.phy_uplink is not None:
         LOG.error(_LE("Uplink detection already done %s"), self.phy_uplink)
         return
     uplink = uplink_dict.get('uplink')
     veth_intf = uplink_dict.get('veth_intf')
     # Logic is as follows:
     # If DB didn't have any uplink it means it's not yet detected or down
     # if DB has uplink and veth, then no need to scan all ports we can
     # start with this veth.
     # If uplink has been removed or modified during restart, then a
     # down will be returned by uplink detection code and it will be
     # removed then.
     # If DB has uplink, but no veth, it's an error condition and in
     # which case remove the uplink port from bridge and start fresh
     if uplink is None or len(uplink) == 0:
         LOG.info(_LI("uplink not discovered yet"))
         self.restart_uplink_called = True
         return
     if veth_intf is not None and len(veth_intf) != 0:
         LOG.info(_LI("veth interface is already added, %(ul)s %(veth)s"),
                  {'ul': uplink, 'veth': veth_intf})
         self.phy_uplink = uplink
         self.veth_intf = veth_intf
         self.restart_uplink_called = True
         return
     LOG.info(_LI("Error case removing the uplink %s from bridge"), uplink)
     ovs_vdp.delete_uplink_and_flows(self.root_helper, self.br_ex, uplink)
     self.restart_uplink_called = True
开发者ID:JoelCapitao,项目名称:networking-cisco,代码行数:31,代码来源:dfa_vdp_mgr.py

示例2: is_fw_drvr_create_needed

    def is_fw_drvr_create_needed(self):
        """This API returns True if a driver init needs to be performed.

        This returns True if a FW is created with a active policy that has
        more than one rule associated with it and if a driver init is NOT
        done.
        """
        LOG.info(_LI("In Drvr create needed %(fw_created)s "
                     "%(active_policy_id)s"
                     " %(is_fw_drvr_created)s %(pol_present)s %(fw_type)s"),
                 {'fw_created': self.fw_created,
                  'active_policy_id': self.active_pol_id,
                  'is_fw_drvr_created': self.is_fw_drvr_created(),
                  'pol_present': self.active_pol_id in self.policies,
                  'fw_type': self.fw_type})
        if self.active_pol_id is not None and (
           self.active_pol_id in self.policies):
            LOG.info(_LI("In Drvr create needed %(len_policy)s %(one_rule)s"),
                     {'len_policy':
                      len(self.policies[self.active_pol_id]['rule_dict']),
                      'one_rule':
                      self.one_rule_present(self.active_pol_id)})
        return self.fw_created and self.active_pol_id and (
            not self.is_fw_drvr_created()) and self.fw_type and (
            self.active_pol_id in self.policies) and (
            len(self.policies[self.active_pol_id]['rule_dict'])) > 0 and (
            self.one_rule_present(self.active_pol_id))
开发者ID:noironetworks,项目名称:networking-cisco,代码行数:27,代码来源:fw_mgr.py

示例3: delete_hosting_device_resources

    def delete_hosting_device_resources(self, context, tenant_id, mgmt_port,
                                        **kwargs):
        attempts = 1
        port_ids = set(p['id'] for p in kwargs['ports'])

        while mgmt_port is not None or port_ids:
            if attempts == DELETION_ATTEMPTS:
                LOG.warning(_LW('Aborting resource deletion after %d '
                                'unsuccessful attempts'), DELETION_ATTEMPTS)
                return
            else:
                if attempts > 1:
                    eventlet.sleep(SECONDS_BETWEEN_DELETION_ATTEMPTS)
                LOG.info(_LI('Resource deletion attempt %d starting'),
                         attempts)
            # Remove anything created.
            if mgmt_port is not None:
                ml = {mgmt_port['id']}
                self._delete_resources(context, "management port",
                                       self._core_plugin.delete_port,
                                       n_exc.PortNotFound, ml)
                if not ml:
                    mgmt_port = None
            self._delete_resources(context, "trunk port",
                                   self._core_plugin.delete_port,
                                   n_exc.PortNotFound, port_ids)
            attempts += 1
        self._safe_delete_t1_network(context, tenant_id)
        self._safe_delete_t2_network(context, tenant_id)
        LOG.info(_LI('Resource deletion succeeded'))
开发者ID:JoelCapitao,项目名称:networking-cisco,代码行数:30,代码来源:n1kv_ml2_trunking_driver.py

示例4: is_fw_complete

    def is_fw_complete(self):
        """This API returns the completion status of FW.

        This returns True if a FW is created with a active policy that has
        more than one rule associated with it and if a driver init is done
        successfully.
        """
        LOG.info(_LI("In fw_complete needed %(fw_created)s "
                     "%(active_policy_id)s %(is_fw_drvr_created)s "
                     "%(pol_present)s %(fw_type)s"),
                 {'fw_created': self.fw_created,
                  'active_policy_id': self.active_pol_id,
                  'is_fw_drvr_created': self.is_fw_drvr_created(),
                  'pol_present': self.active_pol_id in self.policies,
                  'fw_type': self.fw_type})
        if self.active_pol_id is not None:
            LOG.info(_LI("In Drvr create needed %(len_policy)s %(one_rule)s"),
                     {'len_policy':
                      len(self.policies[self.active_pol_id]['rule_dict']),
                      'one_rule':
                      self.one_rule_present(self.active_pol_id)})
        return self.fw_created and self.active_pol_id and (
            self.is_fw_drvr_created()) and self.fw_type and (
            self.active_pol_id in self.policies) and (
            len(self.policies[self.active_pol_id]['rule_dict'])) > 0 and (
            self.one_rule_present(self.active_pol_id))
开发者ID:noironetworks,项目名称:networking-cisco,代码行数:26,代码来源:fw_mgr.py

示例5: get_running_config_router_ids

    def get_running_config_router_ids(self, parsed_cfg):
        rconf_ids = []
        is_multi_region_enabled = cfg.CONF.multi_region.enable_multi_region

        if (is_multi_region_enabled):
            vrf_regex_new = VRF_MULTI_REGION_REGEX_NEW
        else:
            vrf_regex_new = VRF_REGEX_NEW

        for parsed_obj in parsed_cfg.find_objects(vrf_regex_new):
            LOG.info(_LI("VRF object: %s"), (str(parsed_obj)))
            match_obj = re.match(vrf_regex_new, parsed_obj.text)
            router_id = match_obj.group(1)
            LOG.info(_LI("    First 6 digits of router ID: %s\n"),
                        (router_id))
            if (is_multi_region_enabled):
                region_id = match_obj.group(2)
                LOG.info(_LI("    region ID: %s\n"),
                            (region_id))
                my_region_id = cfg.CONF.multi_region.region_id
                if (my_region_id == region_id):
                    rconf_ids.append(router_id)
            else:
                rconf_ids.append(router_id)

        return rconf_ids
开发者ID:JoelCapitao,项目名称:networking-cisco,代码行数:26,代码来源:asr1k_cfg_syncer.py

示例6: clean_vrfs

    def clean_vrfs(self, conn, router_id_dict, parsed_cfg):
        ostk_router_ids = self.get_ostk_router_ids(router_id_dict)
        rconf_ids = self.get_running_config_router_ids(parsed_cfg)

        source_set = set(ostk_router_ids)
        dest_set = set(rconf_ids)

        # add_set = source_set.difference(dest_set)
        del_set = dest_set.difference(source_set)

        LOG.info(_LI("VRF DB set: %s"), (source_set))
        LOG.info(_LI("VRFs to delete: %s"), (del_set))
        # LOG.info("VRFs to add: %s" % (add_set))

        is_multi_region_enabled = cfg.CONF.multi_region.enable_multi_region
        invalid_vrfs = []
        for router_id in del_set:
            if (is_multi_region_enabled):
                my_region_id = cfg.CONF.multi_region.region_id
                invalid_vrfs.append("nrouter-%s-%s" % (router_id,
                                                       my_region_id))
            else:
                invalid_vrfs.append("nrouter-%s" % (router_id))

        if not self.test_mode:
            for vrf_name in invalid_vrfs:
                confstr = asr_snippets.REMOVE_VRF_DEFN % vrf_name
                conn.edit_config(target='running', config=confstr)

        return invalid_vrfs
开发者ID:JoelCapitao,项目名称:networking-cisco,代码行数:30,代码来源:asr1k_cfg_syncer.py

示例7: populate_local_cache

    def populate_local_cache(self):
        """This populates the local cache after reading the Database.

        It calls the appropriate rule create, fw create routines.
        It doesn't actually call the routine to prepare the fabric or cfg the
        device since it will be handled by retry module.
        """
        fw_dict = self.get_all_fw_db()
        LOG.info(_LI("Populating FW Mgr Local Cache"))
        for fw_id in fw_dict:
            fw_data = fw_dict.get(fw_id)
            tenant_id = fw_data.get('tenant_id')
            rule_dict = fw_data.get('rules').get('rules')
            policy_id = fw_data.get('rules').get('firewall_policy_id')
            for rule in rule_dict:
                fw_evt_data = self.convert_fwdb_event_msg(rule_dict.get(rule),
                                                          tenant_id, rule,
                                                          policy_id)
                LOG.info(_LI("Populating Rules for tenant %s"), tenant_id)
                self.fw_rule_create(fw_evt_data, cache=True)
            fw_os_data = self.os_helper.get_fw(fw_id)
            # If enabler is stopped and FW is deleted, then the above routine
            # will fail.
            if fw_os_data is None:
                fw_os_data = self.convert_fwdb(tenant_id, fw_data.get('name'),
                                               policy_id, fw_id)
            LOG.info(_LI("Populating FW for tenant %s"), tenant_id)
            self.fw_create(fw_os_data, cache=True)
            if fw_data.get('device_status') == 'SUCCESS':
                self.fwid_attr[tenant_id].fw_drvr_created(True)
            else:
                self.fwid_attr[tenant_id].fw_drvr_created(False)
        return fw_dict
开发者ID:noironetworks,项目名称:networking-cisco,代码行数:33,代码来源:fw_mgr.py

示例8: process_uplink_event

 def process_uplink_event(self, msg, phy_uplink):
     LOG.info(_LI("Received New uplink Msg %(msg)s for uplink %(uplink)s"),
              {'msg': msg.get_status(), 'uplink': phy_uplink})
     if msg.get_status() == 'up':
         ovs_exc_raised = False
         try:
             self.ovs_vdp_obj_dict[phy_uplink] = ovs_vdp.OVSNeutronVdp(
                 phy_uplink, msg.get_integ_br(), msg.get_ext_br(),
                 msg.get_root_helper())
         except Exception as exc:
             LOG.error(_LE("OVS VDP Object creation failed %s"), str(exc))
             ovs_exc_raised = True
         if (ovs_exc_raised or not self.ovs_vdp_obj_dict[phy_uplink].
                 is_lldpad_setup_done()):
             # Is there a way to delete the object??
             LOG.error(_LE("UP Event Processing NOT Complete"))
             self.err_que.enqueue(constants.Q_UPL_PRIO, msg)
         else:
             self.uplink_det_compl = True
             veth_intf = (self.ovs_vdp_obj_dict[self.phy_uplink].
                          get_lldp_bridge_port())
             LOG.info(_LI("UP Event Processing Complete Saving uplink "
                          "%(ul)s and veth %(veth)s"),
                      {'ul': self.phy_uplink, 'veth': veth_intf})
             self.save_uplink(uplink=self.phy_uplink, veth_intf=veth_intf)
     elif msg.get_status() == 'down':
         # Free the object fixme(padkrish)
         if phy_uplink in self.ovs_vdp_obj_dict:
             self.ovs_vdp_obj_dict[phy_uplink].clear_obj_params()
         else:
             ovs_vdp.delete_uplink_and_flows(self.root_helper, self.br_ex,
                                             phy_uplink)
         self.save_uplink()
开发者ID:JoelCapitao,项目名称:networking-cisco,代码行数:33,代码来源:dfa_vdp_mgr.py

示例9: _set_default_mobility_domain

    def _set_default_mobility_domain(self):
        settings = self._get_settings()
        LOG.info(_LI("settings is %s") % settings)

        if ('globalMobilityDomain' in settings.keys()):
            global_md = settings.get('globalMobilityDomain')
            self._default_md = global_md.get('name')
            LOG.info(_LI("setting default md to be %s") % self._default_md)
        else:
            self._default_md = "md0"
开发者ID:noironetworks,项目名称:networking-cisco,代码行数:10,代码来源:cisco_dfa_rest.py

示例10: process_err_queue

 def process_err_queue(self):
     LOG.info(_LI("Entered Err process_q"))
     try:
         while self.err_que.is_not_empty():
             prio, msg = self.err_que.dequeue_nonblock()
             msg_type = msg.msg_type
             LOG.info(_LI("Msg dequeued from err queue type is %d"), msg_type)
             if msg_type == constants.UPLINK_MSG_TYPE:
                 self.que.enqueue(constants.Q_UPL_PRIO, msg)
     except Exception as e:
         LOG.exceptin(_LE("Exception caught in proc_err_que %s "), str(e))
开发者ID:noironetworks,项目名称:networking-cisco,代码行数:11,代码来源:dfa_vdp_mgr.py

示例11: clean_acls

    def clean_acls(self, conn, intf_segment_dict,
                   segment_nat_dict, parsed_cfg):

        delete_acl_list = []
        is_multi_region_enabled = cfg.CONF.multi_region.enable_multi_region
        if (is_multi_region_enabled):
            acl_regex = ACL_MULTI_REGION_REGEX
        else:
            acl_regex = ACL_REGEX

        acls = parsed_cfg.find_objects(acl_regex)
        for acl in acls:
            LOG.info(_LI("\nacl: %(acl)s") % {'acl': acl})
            match_obj = re.match(acl_regex, acl.text)

            if (is_multi_region_enabled):
                region_id = match_obj.group(1)
                segment_id = match_obj.group(2)
                if region_id != cfg.CONF.multi_region.region_id:
                    if region_id not in cfg.CONF.multi_region.other_region_ids:
                        delete_acl_list.append(acl.text)
                    else:
                        # skip because some other deployment owns
                        # this configuration
                        continue
            else:
                segment_id = match_obj.group(1)
            segment_id = int(segment_id)
            LOG.info(_LI("   segment_id: %(seg_id)s") % {'seg_id': segment_id})

            # Check that segment_id exists in openstack DB info
            if segment_id not in intf_segment_dict:
                LOG.info(_LI("Segment ID not found, deleting acl"))
                delete_acl_list.append(acl.text)
                continue

            # Check that permit rules match subnets defined on openstack intfs
            if self.check_acl_permit_rules_valid(segment_id,
                                                 acl,
                                                 intf_segment_dict) is False:
                delete_acl_list.append(acl.text)
                continue

            self.existing_cfg_dict['acls'][segment_id] = acl

        if not self.test_mode:
            for acl_cfg in delete_acl_list:
                del_cmd = XML_CMD_TAG % ("no %s" % (acl_cfg))
                confstr = XML_FREEFORM_SNIPPET % (del_cmd)
                LOG.info(_LI("Delete ACL: %(del_cmd)s") % {'del_cmd': del_cmd})
                conn.edit_config(target='running', config=confstr)

        return delete_acl_list
开发者ID:JoelCapitao,项目名称:networking-cisco,代码行数:53,代码来源:asr1k_cfg_syncer.py

示例12: subintf_hsrp_ip_check

    def subintf_hsrp_ip_check(self, intf_list, is_external, ip_addr):
        for target_intf in intf_list:
            ha_intf = target_intf['ha_info']['ha_port']
            target_ip = ha_intf['fixed_ips'][0]['ip_address']
            LOG.info(_LI("target_ip: %(target_ip)s, actual_ip: %(ip_addr)s") %
                     {'target_ip': target_ip,
                      'ip_addr': ip_addr})
            if ip_addr != target_ip:
                LOG.info(_LI("HSRP VIP mismatch, deleting"))
                return False

            return True

        return False
开发者ID:JoelCapitao,项目名称:networking-cisco,代码行数:14,代码来源:asr1k_cfg_syncer.py

示例13: _create_svc_vm_hosting_devices

    def _create_svc_vm_hosting_devices(self, context, num, template):
        """Creates <num> or less service VM instances based on <template>.

        These hosting devices can be bound to a certain tenant or for shared
        use. A list with the created hosting device VMs is returned.
        """
        hosting_devices = []
        template_id = template['id']
        credentials_id = template['default_credentials_id']
        plugging_drv = self.get_hosting_device_plugging_driver(context,
                                                               template_id)
        hosting_device_drv = self.get_hosting_device_driver(context,
                                                            template_id)
        if plugging_drv is None or hosting_device_drv is None or num <= 0:
            return hosting_devices
        #TODO(bobmel): Determine value for max_hosted properly
        max_hosted = 1  # template['slot_capacity']
        dev_data, mgmt_context = self._get_resources_properties_for_hd(
            template, credentials_id)
        credentials_info = self._credentials.get(credentials_id)
        if credentials_info is None:
            LOG.error(_LE('Could not find credentials for hosting device'
                          'template %s. Aborting VM hosting device creation.'),
                      template_id)
            return hosting_devices
        connectivity_info = self._get_mgmt_connectivity_info(
            context, self.mgmt_subnet_id())
        for i in range(num):
            complementary_id = uuidutils.generate_uuid()
            res = plugging_drv.create_hosting_device_resources(
                context, complementary_id, self.l3_tenant_id(), mgmt_context,
                max_hosted)
            if res.get('mgmt_port') is None:
                # Required ports could not be created
                return hosting_devices
            connectivity_info['mgmt_port'] = res['mgmt_port']
            vm_instance = self.svc_vm_mgr.dispatch_service_vm(
                context, template['name'] + '_nrouter', template['image'],
                template['flavor'], hosting_device_drv, credentials_info,
                connectivity_info, res.get('ports'))
            if vm_instance is not None:
                dev_data.update(
                    {'id': vm_instance['id'],
                     'complementary_id': complementary_id,
                     'management_ip_address': res['mgmt_port'][
                         'fixed_ips'][0]['ip_address'],
                     'management_port_id': res['mgmt_port']['id']})
                self.create_hosting_device(context,
                                           {'hosting_device': dev_data})
                hosting_devices.append(vm_instance)
            else:
                # Fundamental error like could not contact Nova
                # Cleanup anything we created
                plugging_drv.delete_hosting_device_resources(
                    context, self.l3_tenant_id(), **res)
                break
        LOG.info(_LI('Created %(num)d hosting device VMs based on template '
                     '%(t_id)s'), {'num': len(hosting_devices),
                                   't_id': template_id})
        return hosting_devices
开发者ID:JoelCapitao,项目名称:networking-cisco,代码行数:60,代码来源:hosting_device_manager_db.py

示例14: mgmt_nw_id

 def mgmt_nw_id(cls):
     """Returns id of the management network."""
     if cls._mgmt_nw_uuid is None:
         tenant_id = cls.l3_tenant_id()
         if not tenant_id:
             return
         net = manager.NeutronManager.get_plugin().get_networks(
             neutron_context.get_admin_context(),
             {'tenant_id': [tenant_id],
              'name': [cfg.CONF.general.management_network]},
             ['id', 'subnets'])
         if len(net) == 1:
             num_subnets = len(net[0]['subnets'])
             if num_subnets == 0:
                 LOG.error(_LE('The management network has no subnet. '
                               'Please assign one.'))
                 return
             elif num_subnets > 1:
                 LOG.info(_LI('The management network has %d subnets. The '
                              'first one will be used.'), num_subnets)
             cls._mgmt_nw_uuid = net[0].get('id')
             cls._mgmt_subnet_uuid = net[0]['subnets'][0]
         elif len(net) > 1:
             # Management network must have a unique name.
             LOG.error(_LE('The management network for does not have '
                           'unique name. Please ensure that it is.'))
         else:
             # Management network has not been created.
             LOG.error(_LE('There is no virtual management network. Please '
                           'create one.'))
     return cls._mgmt_nw_uuid
开发者ID:JoelCapitao,项目名称:networking-cisco,代码行数:31,代码来源:hosting_device_manager_db.py

示例15: send_vdp_port_event

    def send_vdp_port_event(self, port_uuid, mac, net_uuid,
                            segmentation_id, status, oui):
        '''Send vNIC UP/Down event to VDP

        :param port_uuid: a ovslib.VifPort object.
        :mac: MAC address of the VNIC
        :param net_uuid: the net_uuid this port is to be associated with.
        :param segmentation_id: the VID for 'vlan' or tunnel ID for 'tunnel'
        :param status: Type of port event. 'up' or 'down'
        :oui: OUI Parameters
        '''
        lldpad_port = self.lldpad_info
        if not lldpad_port:
            LOG.error(_LE("There is no LLDPad port available."))
            return False

        ret = False
        if status == 'up':
            if self.vdp_mode == constants.VDP_SEGMENT_MODE:
                port_name = self.ext_br_obj.get_ofport_name(port_uuid)
                if port_name is None:
                    LOG.error(_LE("Unknown portname for uuid %s"), port_uuid)
                    return False
                LOG.info(_LI('portname for uuid %s is '), port_name)
                ret = self.port_up_segment_mode(lldpad_port, port_name,
                                                port_uuid, mac, net_uuid,
                                                segmentation_id, oui)
        else:
            if self.vdp_mode == constants.VDP_SEGMENT_MODE:
                ret = self.port_down_segment_mode(lldpad_port, port_uuid,
                                                  mac, net_uuid,
                                                  segmentation_id, oui)
        return ret
开发者ID:abattye,项目名称:networking-cisco,代码行数:33,代码来源:ovs_vdp.py


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