Fix decode vim id bug 87/100587/2
authorBin Yang <bin.yang@windriver.com>
Wed, 22 Jan 2020 09:49:46 +0000 (09:49 +0000)
committerBin Yang <bin.yang@windriver.com>
Wed, 22 Jan 2020 10:37:36 +0000 (10:37 +0000)
Change-Id: I9563aba1c750d90c697cd077307b185b9cbd8bf9
Issue-ID: MULTICLOUD-970
Signed-off-by: Bin Yang <bin.yang@windriver.com>
multivimbroker/multivimbroker/pub/msapi/extsys.py

index a76d56a..d925a86 100644 (file)
@@ -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))

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use