Merge "Extra param for OpenStack type when register vim"
This commit is contained in:
@@ -96,9 +96,8 @@ def args2body_vim(config_param, vim):
|
|||||||
ssl_ca_cert = config_param.pop('ssl_ca_cert', '')
|
ssl_ca_cert = config_param.pop('ssl_ca_cert', '')
|
||||||
if ssl_ca_cert:
|
if ssl_ca_cert:
|
||||||
vim['auth_cred']['ssl_ca_cert'] = ssl_ca_cert
|
vim['auth_cred']['ssl_ca_cert'] = ssl_ca_cert
|
||||||
extra = config_param.pop('extra', {})
|
if 'extra' in config_param:
|
||||||
if extra:
|
vim['extra'] = config_param.pop('extra')
|
||||||
vim['extra'] = extra
|
|
||||||
|
|
||||||
|
|
||||||
def validate_auth_url(url):
|
def validate_auth_url(url):
|
||||||
|
@@ -43,6 +43,28 @@ class TestVIMUtils(testtools.TestCase):
|
|||||||
vim_utils.args2body_vim(config_param.copy(), vim)
|
vim_utils.args2body_vim(config_param.copy(), vim)
|
||||||
self.assertEqual(expected_vim, 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):
|
def test_args2body_kubernetes_vim(self):
|
||||||
config_param = {'username': sentinel.usrname1,
|
config_param = {'username': sentinel.usrname1,
|
||||||
'password': sentinel.password1,
|
'password': sentinel.password1,
|
||||||
|
Reference in New Issue
Block a user