def get_uplink_downlink_count(duthost, tbinfo):
    """
    Retrieves uplink and downlink count from DEVICE_NEIGHBOR_METADATA based on topology 

    Args:
        duthost: DUT host object
        tbinfo: information about the running testbed

    Returns:
        uplink count, downlink count

    """
    config_facts = duthost.config_facts(host=duthost.hostname, source="running")['ansible_facts']
    device_neighbor_metadata = config_facts['DEVICE_NEIGHBOR_METADATA']
    topo = tbinfo['topo']['name']

    if "t1" in topo:
        spine_router_count = 0
        tor_router_count = 0
        for neighbor in device_neighbor_metadata.keys():
            neighbor_data = device_neighbor_metadata[neighbor]
            if neighbor_data['type'] == "SpineRouter":
                spine_router_count += 1
            elif neighbor_data['type'] == "ToRRouter":
                tor_router_count += 1
        return spine_router_count, tor_router_count

    elif "t0" in topo:
        leaf_router_count = 0
        server_count = 0
        for neighbor in device_neighbor_metadata.keys():
            neighbor_data = device_neighbor_metadata[neighbor]
            if neighbor_data['type'] == "LeafRouter":
                leaf_router_count += 1
            elif neighbor_data['type'] == "Server":
                server_count += 1
        return leaf_router_count, server_count