Merge "Refactor FT of sol job"

This commit is contained in:
Zuul 2022-02-18 07:24:54 +00:00 committed by Gerrit Code Review
commit a35f9d4bc3
2 changed files with 436 additions and 186 deletions

View File

@ -103,14 +103,16 @@ class BaseTackerTest(base.BaseTestCase):
cls.cinder_client = cls.cinderclient() cls.cinder_client = cls.cinderclient()
@classmethod @classmethod
def get_credentials(cls): def get_credentials(cls, vim_conf_file=None):
vim_params = yaml.safe_load(read_file('local-vim.yaml')) if vim_conf_file is None:
vim_conf_file = 'local-vim.yaml'
vim_params = yaml.safe_load(read_file(vim_conf_file))
vim_params['auth_url'] += '/v3' vim_params['auth_url'] += '/v3'
return vim_params return vim_params
@classmethod @classmethod
def get_auth_session(cls): def get_auth_session(cls, vim_conf_file=None):
vim_params = cls.get_credentials() vim_params = cls.get_credentials(vim_conf_file)
auth = v3.Password( auth = v3.Password(
auth_url=vim_params['auth_url'], auth_url=vim_params['auth_url'],
username=vim_params['username'], username=vim_params['username'],
@ -123,20 +125,20 @@ class BaseTackerTest(base.BaseTestCase):
return auth_ses return auth_ses
@classmethod @classmethod
def tacker_http_client(cls): def tacker_http_client(cls, vim_conf_file=None):
auth_session = cls.get_auth_session() auth_session = cls.get_auth_session(vim_conf_file)
return SessionClient(session=auth_session, return SessionClient(session=auth_session,
service_type='nfv-orchestration', service_type='nfv-orchestration',
region_name='RegionOne') region_name='RegionOne')
@classmethod @classmethod
def tackerclient(cls): def tackerclient(cls, vim_conf_file=None):
auth_session = cls.get_auth_session() auth_session = cls.get_auth_session(vim_conf_file)
return tacker_client.Client(session=auth_session, retries=5) return tacker_client.Client(session=auth_session, retries=5)
@classmethod @classmethod
def novaclient(cls): def novaclient(cls, vim_conf_file=None):
vim_params = cls.get_credentials() vim_params = cls.get_credentials(vim_conf_file)
auth = v3.Password(auth_url=vim_params['auth_url'], auth = v3.Password(auth_url=vim_params['auth_url'],
username=vim_params['username'], username=vim_params['username'],
password=vim_params['password'], password=vim_params['password'],
@ -149,8 +151,8 @@ class BaseTackerTest(base.BaseTestCase):
session=auth_ses) session=auth_ses)
@classmethod @classmethod
def neutronclient(cls): def neutronclient(cls, vim_conf_file=None):
vim_params = cls.get_credentials() vim_params = cls.get_credentials(vim_conf_file)
auth = v3.Password(auth_url=vim_params['auth_url'], auth = v3.Password(auth_url=vim_params['auth_url'],
username=vim_params['username'], username=vim_params['username'],
password=vim_params['password'], password=vim_params['password'],
@ -162,16 +164,18 @@ class BaseTackerTest(base.BaseTestCase):
return neutron_client.Client(session=auth_ses) return neutron_client.Client(session=auth_ses)
@classmethod @classmethod
def heatclient(cls): def heatclient(cls, vim_conf_file=None):
data = yaml.safe_load(read_file('local-vim.yaml')) if vim_conf_file is None:
vim_conf_file = 'local-vim.yaml'
data = yaml.safe_load(read_file(vim_conf_file))
data['auth_url'] = data['auth_url'] + '/v3' data['auth_url'] = data['auth_url'] + '/v3'
domain_name = data.pop('domain_name') domain_name = data.pop('domain_name')
data['user_domain_name'] = domain_name data['user_domain_name'] = domain_name
data['project_domain_name'] = domain_name data['project_domain_name'] = domain_name
return clients.OpenstackClients(auth_attr=data).heat return clients.OpenstackClients(auth_attr=data).heat
def blazarclient(cls): def blazarclient(cls, vim_conf_file=None):
data = cls.get_credentials() data = cls.get_credentials(vim_conf_file)
domain_name = data.pop('domain_name') domain_name = data.pop('domain_name')
data['user_domain_name'] = domain_name data['user_domain_name'] = domain_name
data['project_domain_name'] = domain_name data['project_domain_name'] = domain_name
@ -186,8 +190,8 @@ class BaseTackerTest(base.BaseTestCase):
return client return client
@classmethod @classmethod
def glanceclient(cls): def glanceclient(cls, vim_conf_file=None):
vim_params = cls.get_credentials() vim_params = cls.get_credentials(vim_conf_file)
auth = v3.Password(auth_url=vim_params['auth_url'], auth = v3.Password(auth_url=vim_params['auth_url'],
username=vim_params['username'], username=vim_params['username'],
password=vim_params['password'], password=vim_params['password'],
@ -199,15 +203,15 @@ class BaseTackerTest(base.BaseTestCase):
return glance_client.Client(session=auth_ses) return glance_client.Client(session=auth_ses)
@classmethod @classmethod
def aodh_http_client(cls): def aodh_http_client(cls, vim_conf_file=None):
auth_session = cls.get_auth_session() auth_session = cls.get_auth_session(vim_conf_file)
return SessionClient(session=auth_session, return SessionClient(session=auth_session,
service_type='alarming', service_type='alarming',
region_name='RegionOne') region_name='RegionOne')
@classmethod @classmethod
def cinderclient(cls): def cinderclient(cls, vim_conf_file=None):
vim_params = cls.get_credentials() vim_params = cls.get_credentials(vim_conf_file)
auth = v3.Password(auth_url=vim_params['auth_url'], auth = v3.Password(auth_url=vim_params['auth_url'],
username=vim_params['username'], username=vim_params['username'],
password=vim_params['password'], password=vim_params['password'],

File diff suppressed because it is too large Load Diff