def get_lldp_neighbors(self):
lldp = {}<EOL>command = '<STR_LIT>'<EOL>output = self._send_command(command)<EOL>if '<STR_LIT>' in output:<EOL><INDENT>return {}<EOL><DEDENT>try:<EOL><INDENT>split_output = re.split(r'<STR_LIT>', output, flags=re.M)[<NUM_LIT:1>]<EOL>split_output = re.split(r'<STR_LIT>', split_output, flags=re.M)[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>return {}<EOL><DEDENT>split_output = split_output.strip()<EOL>for lldp_entry in split_output.splitlines():<EOL><INDENT>try:<EOL><INDENT>device_id, local_int_brief, hold_time, capability, remote_port = lldp_entry.split()<EOL><DEDENT>except ValueError:<EOL><INDENT>if len(lldp_entry.split()) == <NUM_LIT:4>:<EOL><INDENT>capability_missing = True if lldp_entry[<NUM_LIT>] == '<STR_LIT:U+0020>' else False<EOL>if capability_missing:<EOL><INDENT>device_id, local_int_brief, hold_time, remote_port = lldp_entry.split()<EOL><DEDENT>else:<EOL><INDENT>tmp_field, hold_time, capability, remote_port = lldp_entry.split()<EOL>device_id = tmp_field[:<NUM_LIT:20>]<EOL>local_int_brief = tmp_field[<NUM_LIT:20>:]<EOL>lldp_tmp = self._lldp_detail_parser(local_int_brief)<EOL>device_id_new = lldp_tmp[<NUM_LIT:3>][<NUM_LIT:0>]<EOL>if device_id_new[:<NUM_LIT:20>] == device_id:<EOL><INDENT>device_id = device_id_new<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT><DEDENT>local_port = self._expand_interface_name(local_int_brief)<EOL>entry = {'<STR_LIT:port>': remote_port, '<STR_LIT>': device_id}<EOL>lldp.setdefault(local_port, [])<EOL>lldp[local_port].append(entry)<EOL><DEDENT>return lldp<EOL>
IOS implementation of get_lldp_neighbors.