X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fv1%2Fvim.py;h=849f6dc7975ef17f01fa8be4b737f326a0a0328f;hb=refs%2Fchanges%2F41%2F9041%2F4;hp=b0033a18bcf030efa414382c8cda020c6885e5d6;hpb=43b6011cb20d2a7e884d7c9dc9baf6f89e886cba;p=osm%2Fosmclient.git diff --git a/osmclient/v1/vim.py b/osmclient/v1/vim.py index b0033a1..849f6dc 100644 --- a/osmclient/v1/vim.py +++ b/osmclient/v1/vim.py @@ -20,7 +20,7 @@ OSM vim API handling from osmclient.common.exceptions import ClientException from osmclient.common.exceptions import NotFound -import json +import yaml import time @@ -65,19 +65,11 @@ class Vim(object): vim_account['datacenter']['type'] = vim_access['vim-type'] vim_config = {} - vim_config['use_floating_ip'] = False + if 'config' in vim_access and vim_access['config'] is not None: + vim_config = yaml.safe_load(vim_access['config']) - if ('floating_ip_pool' in vim_access and - vim_access['floating_ip_pool'] is not None): - vim_config['use_floating_ip'] = True - - if 'keypair' in vim_access and vim_access['keypair'] is not None: - vim_config['keypair'] = vim_access['keypair'] - elif 'config' in vim_access and vim_access['config'] is not None: - if any(var in vim_access['config'] for var in ["admin_password","admin_username","orgname","nsx_user","nsx_password","nsx_manager","vcenter_ip","vcenter_port","vcenter_user","vcenter_password"]): - vim_config = json.loads(vim_access['config']) - - vim_account['datacenter']['config'] = vim_config + if vim_config: + vim_account['datacenter']['config'] = vim_config vim_account = self.update_vim_account_dict(vim_account, vim_access, vim_config)