Esempio n. 1
0
def iperf3_client_parameters(address: typing.Union[str, netaddr.IPAddress],
                             bitrate: int = None,
                             download: bool = None,
                             port: int = None,
                             protocol: str = None,
                             timeout: int = None):
    """Get iperf3 client parameters
    mode allowed values: client or server
    ip is only needed for client mode
    """
    config = tobiko.tobiko_config().iperf3
    if isinstance(address, netaddr.IPAddress):
        address = str(address)
    if bitrate is None:
        bitrate = config.bitrate
    if download is None:
        download = config.download
    if port is None:
        port = config.port
    if protocol is None:
        protocol = config.protocol
    if timeout is None:
        timeout = config.timeout
    return Iperf3ClientParameters(address=address,
                                  bitrate=bitrate,
                                  download=download,
                                  port=port,
                                  protocol=protocol,
                                  timeout=timeout)
Esempio n. 2
0
def configure_caplog(config):
    tobiko_config = tobiko.tobiko_config()

    if tobiko_config.logging.capture_log:
        if tobiko_config.debug:
            level = 'DEBUG'
        else:
            level = 'INFO'
    else:
        level = 'FATAL'
    for key in ['log_level',
                'log_file_level',
                'log_cli_level']:
        set_default_inicfg(config, key, level)

    line_format: str = tobiko_config.logging.line_format
    if line_format:
        # instance and color are not supported by pytest
        line_format = line_format.replace('%(instance)s', '')
        line_format = line_format.replace('%(color)s', '')
        if line_format:
            for key in ['log_format',
                        'log_file_format',
                        'log_cli_format']:
                set_default_inicfg(config, key, line_format)

    date_format = tobiko_config.logging.date_format
    if date_format:
        for key in ['log_date_format',
                    'log_file_date_format',
                    'log_cli_date_format']:
            set_default_inicfg(config, key, date_format)
Esempio n. 3
0
 def get_networking_extensions(self):
     extensions = self.client.list_extensions()
     if isinstance(extensions, abc.Mapping):
         extensions = extensions['extensions']
     ignore_extensions = set(
         tobiko.tobiko_config().neutron.ignore_extensions)
     self.extensions = frozenset(e['alias'] for e in extensions
                                 if e['alias'] not in ignore_extensions)
Esempio n. 4
0
 def setup_fixture(self):
     tobiko_config = tobiko.tobiko_config()
     self.timeout = tobiko_config.testcase.test_runner_timeout
     if self.timeout is None:
         LOG.info('Test runner timeout is disabled')
     else:
         LOG.info('Test runner timeout is enabled: '
                  f'timeout is {self.timeout} seconds')
         self.deadline = tobiko.time() + self.timeout
Esempio n. 5
0
 def setup_fixture(self):
     self.tripleo = tobiko.tobiko_config().tripleo
Esempio n. 6
0
 def setup_fixture(self):
     self.conf = tobiko.tobiko_config().ssh
Esempio n. 7
0
 def vlan_id(self) -> int:
     return tobiko.tobiko_config().neutron.vlan_id
Esempio n. 8
0
def configure_timeout(config):
    tobiko_config = tobiko.tobiko_config()
    default = tobiko_config.testcase.timeout
    if default is not None and default > 0.:
        set_default_inicfg(config, 'timeout', default)
Esempio n. 9
0
 def external_name(self):
     return tobiko.tobiko_config().neutron.external_network
Esempio n. 10
0
 def filenames(self):
     return tuple(tobiko.tobiko_config().neutron.nameservers_filenames)
Esempio n. 11
0
 def ssh_client(self):
     host = tobiko.tobiko_config().neutron.nameservers_host
     if host is None:
         return ssh.ssh_proxy_client()
     else:
         return ssh.ssh_client(host)
Esempio n. 12
0
 def setup_fixture(self):
     keystone_conf = tobiko.tobiko_config().keystone
     self.cloud_name = keystone_conf.cloud_name
     self.clouds_file_dirs = keystone_conf.clouds_file_dirs
     self.clouds_file_names = keystone_conf.clouds_file_names
     self.clouds_files = self.list_cloud_files()
Esempio n. 13
0
def has_ssh_proxy_jump():
    return bool(tobiko.tobiko_config().ssh.proxy_jump)