import re


def parse_show_lldp_neighbor_info(raw_result):
    """
    Parse the 'show lldp neighbor-info' command raw output.

    :param str raw_result: vtysh raw result string.
    :rtype: dict
    :return: The parsed result of the show lldp neighbor-info command in a \
        dictionary of the form:

     ::

            {
                'port': 1,
                'neighbor_entries': 0,
                'neighbor_entries_deleted': 0,
                'neighbor_entries_dropped': 0,
                'neighbor_entries_age_out': 0,
                'neighbor_chassis_name': None,
                'neighbor_chassis_description': None,
                'neighbor_chassis_id': None,
                'neighbor_mgmt_address': None,
                'chassis_capabilities_available': None,
                'chassis_capabilities_enabled': None,
                'neighbor_port_id': None,
                'ttl': None
            }
    """

    neighbor_info_re = (
        r'\s*Port\s+:\s*(?P<port>\d+)\n'
        r'Neighbor entries\s+:\s*(?P<neighbor_entries>\d+)\n'
        r'Neighbor entries deleted\s+:\s*(?P<neighbor_entries_deleted>\d+)\n'
        r'Neighbor entries dropped\s+:\s*(?P<neighbor_entries_dropped>\d+)\n'
        r'Neighbor entries age-out\s+:\s*(?P<neighbor_entries_age_out>\d+)\n'
        r'Neighbor Chassis-Name\s+:\s*(?P<neighbor_chassis_name>\S+)?\n'
        r'Neighbor Chassis-Description\s+:\s*'
        r'(?P<neighbor_chassis_description>[\w\s\n/,.*()_-]+)?'
        r'Neighbor Chassis-ID\s+:\s*(?P<neighbor_chassis_id>[0-9a-f:]+)?\n'
        r'Neighbor Management-Address\s+:\s*'
        r'(?P<neighbor_mgmt_address>[\w:.]+)?\n'
        r'Chassis Capabilities Available\s+:\s*'
        r'(?P<chassis_capabilities_available>[\w\s\n,.*_-]+)?\n'
        r'Chassis Capabilities Enabled\s+:\s*'
        r'(?P<chassis_capabilities_enabled>[\w\s\n,.*_-]+)?\n'
        r'Neighbor Port-ID\s+:\s*(?P<neighbor_port_id>[\w\s\n/,.*_-]+)?\n'
        r'TTL\s+:\s*(?P<ttl>\d+)?'
    )

    re_result = re.match(neighbor_info_re, raw_result)
    assert re_result

    result = re_result.groupdict()
    for key, value in result.items():
        if value and value.isdigit():
            result[key] = int(value)
    return result