def associate(frontend_name, cluster_names, with_dse=False):

    try:
        frontend = get_clusters(frontend_name, all_metadata=True)[frontend_name][0]
    except __HOLE__:
        raise ValueError("No frontend cluster named {} found".format(frontend_name))

    clusters = []
    for c in cluster_names:
        try:
            cluster = get_clusters(c, all_metadata=True)[c][0]
        except IndexError:
            raise ValueError("No cluster named {} found".format(c))
        clusters.append(cluster)

    frontend_ip = frontend['NetworkSettings']['IPAddress']

    # Configure the client credentials on all clusters
    with fab.settings(hosts=frontend_ip):
        frontend_credentials = fab_execute(fab_deploy.get_frontend_credentials).values()[0]

    for cluster in clusters:
        cluster = cluster
        cluster_name = cluster['Config']['Labels']['cluster_name']
        nodes = get_clusters(c)[cluster_name][1:]
        cluster_ip = cluster['NetworkSettings']['IPAddress']
        with fab.settings(hosts=cluster_ip):
            fab_execute(fab_deploy.generate_client_credentials, cluster_name,
                        frontend_credentials['public_key'],
                        frontend_credentials['verify_code'])
            # Get the cluster credentials and jvms list
            cluster_credentials = fab_execute(fab_deploy.get_client_credentials).values()[0]
            jvms = fab_execute(fab_deploy.get_client_jvms).values()[0]

        # Link the cluster to the frontend
        with fab.settings(hosts=frontend_ip):
            fab_execute(fab_deploy.add_cluster_to_frontend, cluster_name, nodes,
                        cluster_credentials['public_key'])
            for jvm in jvms:
                fab_execute(fab_deploy.add_jvm_to_cluster, cluster_name, jvm)

            if with_dse:
                fab_execute(fab_deploy.add_product_to_cluster, cluster_name, 'dse')

        with fab.settings(hosts=cluster_ip, user="root"):
            fab_execute(tasks.setup_client_daemon, frontend['Name'])
            fab_execute(tasks.add_or_update_host_ips, ((frontend['Name'], frontend_ip),))
dataset/ETHPy150Open datastax/cstar_perf/tool/cstar_perf/docker/cstar_docker.py/associate