diff options
author | Bin Yang <bin.yang@windriver.com> | 2020-01-22 09:49:46 +0000 |
---|---|---|
committer | Bin Yang <bin.yang@windriver.com> | 2020-01-22 10:37:36 +0000 |
commit | 15628e77c42c880c4b32bc09261c69164124eaa6 (patch) | |
tree | d91022bd6383cd3964db3d32aca8444bd95e7a76 | |
parent | faa7267c2562cf615bc04543e505c05b14863093 (diff) |
Fix decode vim id bug
Change-Id: I9563aba1c750d90c697cd077307b185b9cbd8bf9
Issue-ID: MULTICLOUD-970
Signed-off-by: Bin Yang <bin.yang@windriver.com>
-rw-r--r-- | multivimbroker/multivimbroker/pub/msapi/extsys.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/multivimbroker/multivimbroker/pub/msapi/extsys.py b/multivimbroker/multivimbroker/pub/msapi/extsys.py index a76d56a..d925a86 100644 --- a/multivimbroker/multivimbroker/pub/msapi/extsys.py +++ b/multivimbroker/multivimbroker/pub/msapi/extsys.py @@ -12,6 +12,7 @@ import json import logging +import re from multivimbroker.pub.exceptions import VimBrokerException from multivimbroker.pub.utils import restcall @@ -46,9 +47,9 @@ def encode_vim_id(cloud_owner, cloud_region_id): def decode_vim_id(vim_id): - # m = re.search(r'^([0-9a-zA-Z-]+)_([0-9a-zA-Z_-]+)$', vim_id) - # cloud_owner, cloud_region_id = m.group(1), m.group(2) - return split_vim_to_owner_region(vim_id) + m = re.search(r'^([0-9a-zA-Z-]+)_([0-9a-zA-Z_-]+)$', vim_id) + cloud_owner, cloud_region_id = m.group(1), m.group(2) + return cloud_owner, cloud_region_id def split_vim_to_owner_region(vim_id): @@ -65,7 +66,7 @@ def get_vim_by_id(vim_id): "version": "4.0", "vimId": vim_id } - cloud_owner, cloud_region = split_vim_to_owner_region(vim_id) + cloud_owner, cloud_region = decode_vim_id(vim_id) ret = restcall.get_res_from_aai("/cloud-infrastructure/cloud-regions/" "cloud-region/%s/%s" % ( cloud_owner, cloud_region)) |