Ejemplo n.º 1
0
 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)
    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:
            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)
    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)
Ejemplo n.º 4
0
    def vxlan_ucast_supported(self):
        if not cfg.CONF.VXLAN.l2_population:
            return False
        if not ip_lib.iproute_arg_supported(['bridge', 'fdb'], 'append',
                                            self.root_helper):
            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
        for segmentation_id in range(1, constants.MAX_VXLAN_VNI + 1):
            if not ip_lib.device_exists(
                    self.get_vxlan_device_name(segmentation_id)):
                break
        else:
            LOG.error(_('No valid Segmentation ID to perform UCAST test.'))
            return False

        test_iface = self.ensure_vxlan(segmentation_id)
        try:
            utils.execute(cmd=[
                'bridge', 'fdb', 'append', constants.FLOODING_ENTRY[0], 'dev',
                test_iface, 'dst', '1.1.1.1'
            ],
                          root_helper=self.root_helper)
            return True
        except RuntimeError:
            return False
        finally:
            self.delete_vxlan(test_iface)
    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)
    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)
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
    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
 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)
    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
Ejemplo n.º 11
0
    def vxlan_mcast_supported(self):
        if not cfg.CONF.VXLAN.vxlan_group:
            LOG.warning(_LW('VXLAN muticast group(s) 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