hpimdm/Main.py
def list_neighbors(ipv4=False, ipv6=False):
    """
    List all neighbors in a human readable format
    """
    if ipv4:
        interfaces_list = interfaces.values()
    elif ipv6:
        interfaces_list = interfaces_v6.values()
    else:
        return "Unknown IP family"

    t = PrettyTable(['Interface', 'Neighbor IP', 'State', 'Hello Hold Time', 'BootTime', 'NeighborSnapshotSN', 'Uptime'])
    check_time = time.time()
    for interface in interfaces_list:
        for neighbor in interface.get_neighbors():
            uptime = check_time - neighbor.time_of_last_update
            uptime = 0 if (uptime < 0) else uptime

            t.add_row(
                [interface.interface_name, neighbor.ip, neighbor.neighbor_state.__name__, neighbor.hello_hold_time,
                 neighbor.time_of_boot, neighbor.neighbor_snapshot_sn, time.strftime("%H:%M:%S", time.gmtime(uptime))])
    print(t)
    return str(t)

    List all neighbors in a human readable format
    
List all neighbors in a human readable format
List all neighbors in a human readable format
def list_neighbors(ipv4=False, ipv6=False):
    if ipv4:
        interfaces_list = interfaces.values()
    elif ipv6:
        interfaces_list = interfaces_v6.values()
    else:
        return "Unknown IP family"
    t = PrettyTable(['Interface', 'Neighbor IP', 'State', 'Hello Hold Time', 'BootTime', 'NeighborSnapshotSN', 'Uptime'])
    check_time = time.time()
    for interface in interfaces_list:
        for neighbor in interface.get_neighbors():
            uptime = check_time - neighbor.time_of_last_update
            uptime = 0 if (uptime < 0) else uptime
            t.add_row(
                [interface.interface_name, neighbor.ip, neighbor.neighbor_state.__name__, neighbor.hello_hold_time,
                 neighbor.time_of_boot, neighbor.neighbor_snapshot_sn, time.strftime("%H:%M:%S", time.gmtime(uptime))])
    print(t)
    return str(t)
def list_neighbors ( ipv4 = False , ipv6 = False ) : if ipv4 : interfaces_list = interfaces . values ( ) elif ipv6 : interfaces_list = interfaces_v6 . values ( ) else : return "Unknown IP family" t = PrettyTable ( [ 'Interface' , 'Neighbor IP' , 'State' , 'Hello Hold Time' , 'BootTime' , 'NeighborSnapshotSN' , 'Uptime' ] ) check_time = time . time ( ) for interface in interfaces_list : for neighbor in interface . get_neighbors ( ) : uptime = check_time - neighbor . time_of_last_update uptime = 0 if ( uptime < 0 ) else uptime t . add_row ( [ interface . interface_name , neighbor . ip , neighbor . neighbor_state . __name__ , neighbor . hello_hold_time , neighbor . time_of_boot , neighbor . neighbor_snapshot_sn , time . strftime ( "%H:%M:%S" , time . gmtime ( uptime ) ) ] ) print ( t ) return str ( t )
List all neighbors in a human readable format
List all neighbors in a human readable format
"""
    List all neighbors in a human readable format
    """
ipv4
ipv6