'Initialize attributes for establishing connection to target device.
:param ip: IP address of target device. Not required if `host` is
provided.
:type ip: str
:param host: Hostname of target device. Not required if `ip` is
provided.
:type host: str
:param username: Username to authenticate against target device if
required.
:type username: str
:param password: Password to authenticate against target device if
required.
:type password: str
:param secret: The enable password if target device requires one.
:type secret: str
:param port: The destination port used to connect to the target
device.
:type port: int or None
:param device_type: Class selection based on device type.
:type device_type: str
:param verbose: Enable additional messages to standard output.
:type verbose: bool
:param global_delay_factor: Multiplication factor affecting Netmiko delays (default: 1).
:type global_delay_factor: int
:param use_keys: Connect to target device using SSH keys.
:type use_keys: bool
:param key_file: Filename path of the SSH key file to use.
:type key_file: str
:param allow_agent: Enable use of SSH key-agent.
:type allow_agent: bool
:param ssh_strict: Automatically reject unknown SSH host keys (default: False, which
means unknown SSH host keys will be accepted).
:type ssh_strict: bool
:param system_host_keys: Load host keys from the user\'s \'known_hosts\' file.
:type system_host_keys: bool
:param alt_host_keys: If `True` host keys will be loaded from the file specified in
\'alt_key_file\'.
:type alt_host_keys: bool
:param alt_key_file: SSH host key file to use (if alt_host_keys=True).
:type alt_key_file: str
:param ssh_config_file: File name of OpenSSH configuration file.
:type ssh_config_file: str
:param timeout: Connection timeout.
:type timeout: float
:param session_timeout: Set a timeout for parallel requests.
:type session_timeout: float
:param keepalive: Send SSH keepalive packets at a specific interval, in seconds.
Currently defaults to 0, for backwards compatibility (it will not attempt
to keep the connection alive).
:type keepalive: int'

def __init__(self, ip=u'', host=u'', username=u'', password=u'', secret=u'', port=None, device_type=u'', verbose=False, global_delay_factor=1, use_keys=False, key_file=None, allow_agent=False, ssh_strict=False, system_host_keys=False, alt_host_keys=False, alt_key_file=u'', ssh_config_file=None, timeout=8, session_timeout=60, keepalive=0):

    if ip:
        self.host = ip
        self.ip = ip
    elif host:
        self.host = host
    if ((not ip) and (not host)):
        raise ValueError(u'Either    ip    or    host    must    be    set')
    if (port is None):
        if (u'telnet' in device_type):
            self.port = 23
        else:
            self.port = 22
    else:
        self.port = int(port)
    self.username = username
    self.password = password
    self.secret = secret
    self.device_type = device_type
    self.ansi_escape_codes = False
    self.verbose = verbose
    self.timeout = timeout
    self.session_timeout = session_timeout
    self.keepalive = keepalive
    self.global_delay_factor = global_delay_factor
    self.base_prompt = u''
    self._session_locker = Lock()
    if (u'_telnet' in device_type):
        self.protocol = u'telnet'
        self._modify_connection_params()
        self.establish_connection()
        self.session_preparation()
    else:
        self.protocol = u'ssh'
        if (not ssh_strict):
            self.key_policy = paramiko.AutoAddPolicy()
        else:
            self.key_policy = paramiko.RejectPolicy()
        self.use_keys = use_keys
        self.key_file = key_file
        self.allow_agent = allow_agent
        self.system_host_keys = system_host_keys
        self.alt_host_keys = alt_host_keys
        self.alt_key_file = alt_key_file
        self.ssh_config_file = ssh_config_file
        self._modify_connection_params()
        self.establish_connection()
        self.session_preparation()
    time.sleep((0.3 * self.global_delay_factor))
    self.clear_buffer()
