- def run_exec_request(self, exec_command):
- response = stream(self.api_instance.connect_get_namespaced_pod_exec,
- name=self.pod_name,
- # container="container-name",
- namespace="onap",
- command=exec_command,
- stdin=False,
- tty=False,
- stderr=True,
- stdout=True)
- return response
-
- def check_region_in_db(self):
- exec_command = [
- "/bin/sh",
- "-c",
- f"mysql -uroot -p{self.password} catalogdb -e 'SELECT * FROM cloud_sites;'"]
- response = self.run_exec_request(exec_command)
-
- is_region_found = False
- for line in response.split("\n"):
- if line.split("\t")[0] == self.CLOUD_REGION_ID:
- print(line)
- is_region_found = True
- return is_region_found
- return is_region_found
-
- def add_region_to_so_db(self):
- exec_command = [
- "/bin/sh",
- "-c",
- f"mysql -uroot -p{self.password} catalogdb -e "
- f"'insert into cloud_sites(ID, REGION_ID, IDENTITY_SERVICE_ID, CLOUD_VERSION, CLLI, ORCHESTRATOR ) "
- f"values (\"{self.CLOUD_REGION_ID}\", \"{self.CLOUD_REGION_ID}\", \"DEFAULT_KEYSTONE\", \"2.5\", "
- f"\"{self.COMPLEX_ID}\", \"multicloud\");'"]
+ data = {
+ "id": cloud_region_id,
+ "region_id": cloud_region_id,
+ "aic_version": "2.5",
+ "clli": complex_id,
+ "orchestrator": orchestrator,
+ "identityService": {
+ "id": identity_service_id,
+ "identityServerTypeAsString": "KEYSTONE",
+ "hibernateLazyInitializer": {},
+ "identity_url": identity_url,
+ "mso_id": mso_id,
+ "mso_pass": mso_pass,
+ "project_domain_name": project_domain_name,
+ "user_domain_name": user_domain_name,
+ "admin_tenant": admin_tenant,
+ "member_role": member_role,
+ "tenant_metadata": True,
+ "identity_server_type": identity_server_type,
+ "identity_authentication_type": identity_authentication_type
+ }
+ }