def get_node_ids(apic, args):
    """
    Get the list of node ids from the command line arguments.
    If none, get all of the node ids
    :param apic: Session instance logged in to the APIC
    :param args: Command line arguments
    :return: List of strings containing node ids
    """
    if args.switch is not None:
        names = [args.switch]
    else:
        names = []
        query_url = '/api/node/class/fabricNode.json?query-target-filter=eq(fabricNode.role,"leaf")'
        resp = apic.get(query_url)
        if not resp.ok:
            print('Could not get switch list from APIC.')
            return
        nodes = resp.json()['imdata']
        for node in nodes:
            names.append(str(node['fabricNode']['attributes']['id']))
    return names