def gather_basic_facts(device):
    """
    Using the provide Junos Device object, retrieve basic facts about the device.

    Parameters
    ----------
    device : Device
        The Junos device instance

    Returns
    -------
    dict
        A collection of basic facts about the device that will be stored in the database.
    """
    basic_facts = dict()
    basic_facts['os_version'] = device.facts['version']
    basic_facts['hostname'] = device.facts['hostname']
    basic_facts['device_sn'] = device.facts['serialnumber']
    basic_facts['device_model'] = device.facts['model']
    config = device.rpc.get_config(filter_xml='system/services/outbound-ssh')
    servers = config.xpath('.//servers/name')
    server_ipaddr = servers[0].text
    resp = device.rpc.get_route_information(destination=server_ipaddr)
    if_name = resp.xpath('.//via | .//nh-local-interface')[0].text
    basic_facts['mgmt_interface'] = if_name.partition('.')[0]
    if_info = device.rpc.get_interface_information(interface_name=if_name,
        terse=True)
    basic_facts['mgmt_ipaddr'] = if_info.findtext('.//ifa-local').partition('/'
        )[0].strip()
    resp = device.rpc.get_interface_information(interface_name=basic_facts[
        'mgmt_interface'], media=True)
    found = resp.findtext('.//current-physical-address').strip()
    basic_facts['mgmt_macaddr'] = found
    return basic_facts
