From 2eba9951d0366a7aff90554bbc48db828a8e3ddf Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Mon, 21 May 2018 16:45:33 +0200 Subject: [PATCH] fix bug in vim-create with config Change-Id: I9b4030aa18c2274c06bc40a55b1fb8f2c1e40be0 Signed-off-by: garciadeblas --- osmclient/scripts/osm.py | 2 +- osmclient/sol005/vim.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 66d1f32..78dd232 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -861,7 +861,7 @@ def vim_create(ctx, vim['vim-tenant-name'] = tenant vim['vim-type'] = account_type vim['description'] = description - vim ['config'] = config + vim['config'] = config if sdn_controller or sdn_port_mapping: ctx.obj.vim.create(name, vim, sdn_controller, sdn_port_mapping) else: diff --git a/osmclient/sol005/vim.py b/osmclient/sol005/vim.py index 9d10302..dc107ef 100644 --- a/osmclient/sol005/vim.py +++ b/osmclient/sol005/vim.py @@ -31,10 +31,10 @@ class Vim(object): self._client = client self._apiName = '/admin' self._apiVersion = '/v1' - self._apiResource = '/vims' + self._apiResource = '/vim_accounts' self._apiBase = '{}{}{}'.format(self._apiName, self._apiVersion, self._apiResource) - def create(self, name, vim_access, sdn_controller, sdn_port_mapping): + def create(self, name, vim_access, sdn_controller=None, sdn_port_mapping=None): if 'vim-type' not in vim_access: #'openstack' not in vim_access['vim-type']): raise Exception("vim type not provided") @@ -43,9 +43,9 @@ class Vim(object): vim_account['name'] = name vim_account = self.update_vim_account_dict(vim_account, vim_access) - vim_config = {} + vim_config = {'hello': 'hello'} if 'config' in vim_access and vim_access['config'] is not None: - vim_config = json.loads(vim_access['config']) + vim_config = yaml.safe_load(vim_access['config']) if sdn_controller: sdnc = self._client.sdnc.get(sdn_controller) vim_config['sdn-controller'] = sdnc['_id'] @@ -78,7 +78,7 @@ class Vim(object): if config=="": vim_config = None else: - vim_config = json.loads(vim_account['config']) + vim_config = yaml.safe_load(vim_account['config']) if sdn_controller: sdnc = self._client.sdnc.get(sdn_controller) vim_config['sdn-controller'] = sdnc['_id'] -- 2.25.1