X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fvim.py;h=8b11c8dd3f7534cf3476f99f2acbb11bc154d956;hb=70208ca1de7ff0e91a17d8f918d5b6044e9fa388;hp=e5bf399bcff4943a1bcb0152a1f61b2837948bd2;hpb=4335f9962fec0516628b5d0b8337fc977e55669c;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/vim.py b/osmclient/sol005/vim.py index e5bf399..8b11c8d 100644 --- a/osmclient/sol005/vim.py +++ b/osmclient/sol005/vim.py @@ -72,16 +72,26 @@ class Vim(object): def create( self, name, vim_access, sdn_controller=None, sdn_port_mapping=None, wait=False ): + vca_id = None + + def get_vca_id(vca): + vca = self._client.vca.get(vca) + if vca is None: + raise NotFound("cannot find vca '{}'".format(vca)) + return vca["_id"] + self._logger.debug("") self._client.get_token() + if "vca" in vim_access: + vca_id = get_vca_id(vim_access["vca"]) if "vim-type" not in vim_access: # 'openstack' not in vim_access['vim-type']): raise Exception("vim type not provided") - vim_account = {} vim_account["name"] = name vim_account = self.update_vim_account_dict(vim_account, vim_access) - + if vca_id: + vim_account["vca"] = vca_id vim_config = {} if "config" in vim_access and vim_access["config"] is not None: vim_config = yaml.safe_load(vim_access["config"])