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


Python ip_lib.iproute_arg_supported函数代码示例

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


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

示例1: vxlan_ucast_supported

    def vxlan_ucast_supported(self):
        if not cfg.CONF.VXLAN.l2_population:
            return False
        if not ip_lib.iproute_arg_supported(
                ['bridge', 'fdb'], 'append'):
            LOG.warning(_LW('Option "%(option)s" must be supported by command '
                            '"%(command)s" to enable %(mode)s mode'),
                        {'option': 'append',
                         'command': 'bridge fdb',
                         'mode': 'VXLAN UCAST'})
            return False

        test_iface = None
        for seg_id in moves.range(1, p_const.MAX_VXLAN_VNI + 1):
            if not ip_lib.device_exists(
                    self.get_vxlan_device_name(seg_id)):
                test_iface = self.ensure_vxlan(seg_id)
                break
        else:
            LOG.error(_LE('No valid Segmentation ID to perform UCAST test.'))
            return False

        try:
            utils.execute(
                cmd=['bridge', 'fdb', 'append', constants.FLOODING_ENTRY[0],
                     'dev', test_iface, 'dst', '1.1.1.1'],
                run_as_root=True, log_fail_as_error=False)
            return True
        except RuntimeError:
            return False
        finally:
            self.delete_vxlan(test_iface)
开发者ID:rajeshmohan,项目名称:neutron,代码行数:32,代码来源:linuxbridge_neutron_agent.py

示例2: vxlan_ucast_supported

    def vxlan_ucast_supported(self):
        if not cfg.CONF.VXLAN.l2_population:
            return False
        if not ip_lib.iproute_arg_supported(
                ['bridge', 'fdb'], 'append'):
            LOG.warning('Option "%(option)s" must be supported by command '
                        '"%(command)s" to enable %(mode)s mode',
                        {'option': 'append',
                         'command': 'bridge fdb',
                         'mode': 'VXLAN UCAST'})
            return False

        test_iface = None
        for seg_id in moves.range(1, constants.MAX_VXLAN_VNI + 1):
            if (ip_lib.device_exists(self.get_vxlan_device_name(seg_id)) or
                    ip_lib.vxlan_in_use(seg_id)):
                continue
            test_iface = self.ensure_vxlan(seg_id)
            break
        else:
            LOG.error('No valid Segmentation ID to perform UCAST test.')
            return False

        try:
            bridge_lib.FdbInterface.append(constants.FLOODING_ENTRY[0],
                                           test_iface, '1.1.1.1',
                                           log_fail_as_error=False)
            return True
        except RuntimeError:
            return False
        finally:
            self.delete_interface(test_iface)
开发者ID:noironetworks,项目名称:neutron,代码行数:32,代码来源:linuxbridge_neutron_agent.py

示例3: vxlan_ucast_supported

    def vxlan_ucast_supported(self):
        if not cfg.CONF.VXLAN.l2_population:
            return False
        if not ip_lib.iproute_arg_supported(["bridge", "fdb"], "append"):
            LOG.warning(
                _LW('Option "%(option)s" must be supported by command ' '"%(command)s" to enable %(mode)s mode'),
                {"option": "append", "command": "bridge fdb", "mode": "VXLAN UCAST"},
            )
            return False

        test_iface = None
        for seg_id in moves.range(1, p_const.MAX_VXLAN_VNI + 1):
            if ip_lib.device_exists(self.get_vxlan_device_name(seg_id)) or ip_lib.vxlan_in_use(seg_id):
                continue
            test_iface = self.ensure_vxlan(seg_id)
            break
        else:
            LOG.error(_LE("No valid Segmentation ID to perform UCAST test."))
            return False

        try:
            utils.execute(
                cmd=["bridge", "fdb", "append", constants.FLOODING_ENTRY[0], "dev", test_iface, "dst", "1.1.1.1"],
                run_as_root=True,
                log_fail_as_error=False,
            )
            return True
        except RuntimeError:
            return False
        finally:
            self.delete_interface(test_iface)
开发者ID:FedericoRessi,项目名称:neutron,代码行数:31,代码来源:linuxbridge_neutron_agent.py

示例4: vxlan_mcast_supported

    def vxlan_mcast_supported(self):
        if not cfg.CONF.VXLAN.vxlan_group:
            LOG.warning(_("VXLAN muticast group must be provided in " "vxlan_group option to enable VXLAN MCAST mode"))
            return False
        if not ip_lib.iproute_arg_supported(["ip", "link", "add", "type", "vxlan"], "proxy", self.root_helper):
            LOG.warning(
                _('Option "%(option)s" must be supported by command ' '"%(command)s" to enable %(mode)s mode')
                % {"option": "proxy", "command": "ip link add type vxlan", "mode": "VXLAN MCAST"}
            )

            return False
        return True
开发者ID:cboling,项目名称:SDNdbg,代码行数:12,代码来源:linuxbridge_neutron_agent.py

示例5: check_vxlan_support

 def check_vxlan_support(self):
     kernel_version = dist_version.LooseVersion(platform.release())
     if cfg.CONF.VXLAN.l2_population and (
             kernel_version > dist_version.LooseVersion(
             lconst.MIN_VXLAN_KVER[lconst.VXLAN_UCAST])) and (
             ip_lib.iproute_arg_supported(['bridge', 'fdb'],
                                          'append', self.root_helper)):
         self.vxlan_mode = lconst.VXLAN_UCAST
     elif (kernel_version > dist_version.LooseVersion(
             lconst.MIN_VXLAN_KVER[lconst.VXLAN_MCAST])) and (
             ip_lib.iproute_arg_supported(['ip', 'link', 'add',
                                           'type', 'vxlan'], 'proxy',
                                          self.root_helper)):
         if cfg.CONF.VXLAN.vxlan_group:
             self.vxlan_mode = lconst.VXLAN_MCAST
         else:
             self.vxlan_mode = lconst.VXLAN_NONE
             LOG.warning(_('VXLAN muticast group must be provided in '
                           'vxlan_group option to enable VXLAN'))
     else:
         self.vxlan_mode = lconst.VXLAN_NONE
         LOG.warning(_('Unable to use VXLAN, it requires at least 3.8 '
                       'linux kernel and iproute2 3.8'))
     LOG.debug(_('Using %s VXLAN mode'), self.vxlan_mode)
开发者ID:noelbk,项目名称:neutron-juniper,代码行数:24,代码来源:linuxbridge_neutron_agent.py

示例6: vxlan_mcast_supported

    def vxlan_mcast_supported(self):
        if not cfg.CONF.VXLAN.vxlan_group:
            LOG.warning(_LW('VXLAN muticast group must be provided in '
                            'vxlan_group option to enable VXLAN MCAST mode'))
            return False
        if not ip_lib.iproute_arg_supported(
                ['ip', 'link', 'add', 'type', 'vxlan'],
                'proxy'):
            LOG.warning(_LW('Option "%(option)s" must be supported by command '
                            '"%(command)s" to enable %(mode)s mode'),
                        {'option': 'proxy',
                         'command': 'ip link add type vxlan',
                         'mode': 'VXLAN MCAST'})

            return False
        return True
开发者ID:rajeshmohan,项目名称:neutron,代码行数:16,代码来源:linuxbridge_neutron_agent.py


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