コード例 #1
0
ファイル: internal_api.py プロジェクト: couchbase/testrunner
 def get_nodes_formatted(pod,
                         tenant,
                         cluster_id,
                         username=None,
                         password=None):
     servers = capella_utils.get_nodes(pod, tenant, cluster_id)
     nodes = list()
     for server in servers:
         temp_server = TestInputServer()
         temp_server.ip = server.get("hostname")
         temp_server.hostname = server.get("hostname")
         capella_services = server.get("services")
         services = []
         for service in capella_services:
             if service == "Data":
                 services.append("kv")
             elif service == "Index":
                 services.append("index")
             elif service == "Query":
                 services.append("n1ql")
             elif service == "Search":
                 services.append("fts")
             elif service == "Eventing":
                 services.append("eventing")
             elif service == "Analytics":
                 services.append("cbas")
         temp_server.services = services
         temp_server.port = "18091"
         temp_server.rest_username = username
         temp_server.rest_password = password
         temp_server.hosted_on_cloud = True
         temp_server.memcached_port = "11207"
         nodes.append(temp_server)
     return nodes
コード例 #2
0
    def __populate_cluster_info(self, cluster_id, servers, cluster_srv,
                                cluster_name, service_config):
        nodes = list()
        for server in servers:
            temp_server = TestInputServer()
            temp_server.ip = server.get("hostname")
            temp_server.hostname = server.get("hostname")
            temp_server.services = server.get("services")
            temp_server.port = "18091"
            temp_server.rest_username = self.rest_username
            temp_server.rest_password = self.rest_password
            temp_server.hosted_on_cloud = True
            temp_server.memcached_port = "11207"
            nodes.append(temp_server)
        cluster = CBCluster(username=self.rest_username,
                            password=self.rest_password,
                            servers=[None] * 40)
        cluster.id = cluster_id
        cluster.srv = cluster_srv
        cluster.cluster_config = service_config
        cluster.pod = self.pod
        cluster.tenant = self.tenant

        for temp_server in nodes:
            if "Data" in temp_server.services:
                cluster.kv_nodes.append(temp_server)
            if "Query" in temp_server.services:
                cluster.query_nodes.append(temp_server)
            if "Index" in temp_server.services:
                cluster.index_nodes.append(temp_server)
            if "Eventing" in temp_server.services:
                cluster.eventing_nodes.append(temp_server)
            if "Analytics" in temp_server.services:
                cluster.cbas_nodes.append(temp_server)
            if "FTS" in temp_server.services:
                cluster.fts_nodes.append(temp_server)
        cluster.master = cluster.kv_nodes[0]
        self.tenant.clusters.update({cluster.id: cluster})

        cluster.master = cluster.kv_nodes[0]
        self.tenant.clusters.update({cluster.id: cluster})
        self.cb_clusters[cluster_name] = cluster
        self.cb_clusters[cluster_name].cloud_cluster = True