Extra param for OpenStack type when register vim
This patch changes to allow setting the `extra` parameter in the VIM configuration for openstack vim type. Implements: blueprint enhance-api-policy Change-Id: I37a3e21afced0aae6e0fd3c0cbb28ab16f2b7df8
This commit is contained in:
parent
82bf387f77
commit
e398f422a8
tackerclient
@ -96,9 +96,8 @@ def args2body_vim(config_param, vim):
|
||||
ssl_ca_cert = config_param.pop('ssl_ca_cert', '')
|
||||
if ssl_ca_cert:
|
||||
vim['auth_cred']['ssl_ca_cert'] = ssl_ca_cert
|
||||
extra = config_param.pop('extra', {})
|
||||
if extra:
|
||||
vim['extra'] = extra
|
||||
if 'extra' in config_param:
|
||||
vim['extra'] = config_param.pop('extra')
|
||||
|
||||
|
||||
def validate_auth_url(url):
|
||||
|
@ -43,6 +43,28 @@ class TestVIMUtils(testtools.TestCase):
|
||||
vim_utils.args2body_vim(config_param.copy(), vim)
|
||||
self.assertEqual(expected_vim, vim)
|
||||
|
||||
def test_args2body_vim_extra(self):
|
||||
auth_cred = {'username': sentinel.usrname1,
|
||||
'password': sentinel.password1,
|
||||
'user_domain_name': sentinel.user_domain.name,
|
||||
'cert_verify': 'True'}
|
||||
config_param = {'project_name': sentinel.prj_name,
|
||||
'project_domain_name': sentinel.prj_domain_name1,
|
||||
'type': 'openstack',
|
||||
'extra': {'area': 'area_A@region_A'},
|
||||
**auth_cred}
|
||||
vim = {}
|
||||
|
||||
expected_vim = {'auth_cred': auth_cred,
|
||||
'vim_project':
|
||||
{'name': sentinel.prj_name,
|
||||
'project_domain_name': sentinel.prj_domain_name1},
|
||||
'type': 'openstack',
|
||||
'extra': {'area': 'area_A@region_A'}}
|
||||
|
||||
vim_utils.args2body_vim(config_param.copy(), vim)
|
||||
self.assertEqual(expected_vim, vim)
|
||||
|
||||
def test_args2body_kubernetes_vim(self):
|
||||
config_param = {'username': sentinel.usrname1,
|
||||
'password': sentinel.password1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user