- vim_account_info = CollectorUtils.get_credentials(vim_account_id)
- cfg = json.loads(vim_account_info.config)
- self.vrops_site = cfg['vrops_site']
- self.vrops_user = cfg['vrops_user']
- self.vrops_password = cfg['vrops_password']
- self.client = self.connect_client(vim_account_id)
-
- def connect_client(self, vim_account_id: str):
- vim_account_details = VimCredentialsRepository.get(VimCredentials.uuid == vim_account_id)
- verify_ssl = CollectorUtils.is_verify_ssl(vim_account_details)
- auth = v3.Password(auth_url=vim_account_details.url,
- username=vim_account_details.user,
- password=vim_account_details.password,
- project_name=vim_account_details.tenant_name,
- project_domain_id='default',
- user_domain_id='default')
- sess = session.Session(auth=auth, verify=verify_ssl)
- client = nClient.Client('2.1', session=sess, endpoint_type=None)
- return client
-
- def _get_resource_uuid(self, nsr_id, vnf_member_index, vdur_name) -> str:
- vdur = self.common_db.get_vdur(nsr_id, vnf_member_index, vdur_name)
- return vdur['vim-id']
-
- def get_vm_name_and_id(self, resource_uuid):
- """ Method to find vm name and id using resource_uuid
- """
- server = self.client.servers.find(id=resource_uuid)
- name = server.to_dict()['name']
- _id = server.to_dict()['id']
- return name, _id
+ cfg = self.get_vim_account(vim_account_id)
+ self.vrops = vROPS_Helper(
+ vrops_site=cfg["vrops_site"],
+ vrops_user=cfg["vrops_user"],
+ vrops_password=cfg["vrops_password"],
+ )