def parse_neighbors_data(data):
    neighbors_table = []

    if "data" in data:
        raw_data = data["data"]

        for line in raw_data.split("\n"):
            if line.strip() and not line.startswith("Address") and "---" not in line:
                neighbors_info = line.split()
                if len(neighbors_info) >= 4:
                    neighbors_table.append({
                        "address": neighbors_info[0],
                        "interface": neighbors_info[1],
                        "link_layer_address": neighbors_info[2],
                        "state": neighbors_info[3]
                    })

    return neighbors_table
    
def generate_neighbors_json(neighbors_table):
    return {"neighbors_table": neighbors_table}