diff options
author | Harry Huang <huangxiangyu5@huawei.com> | 2017-03-17 17:23:17 +0800 |
---|---|---|
committer | Yingjun Li <yingjun.li@huawei.com> | 2017-03-17 09:33:43 +0000 |
commit | 30a31341d6ff1b4dcd6ca6fd3d55496d7d65d762 (patch) | |
tree | 12385de8230337a8cee9be5df01f9ff8a09fbd94 /opera/openo_connect.py | |
parent | 232621ddb66227281745ef9f9fca75e66c58c686 (diff) |
add get_vnfm_ip
add function get_vnfm_ip to get juju client vm ip
Change-Id: Ib78d81ab2bb54ecc197581913c5127235bc563da
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
(cherry picked from commit 4867ce93ff214e5bcb1b3b178173080a17bfc5dd)
Diffstat (limited to 'opera/openo_connect.py')
-rwxr-xr-x | opera/openo_connect.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/opera/openo_connect.py b/opera/openo_connect.py index 4e9e4fb..efaa882 100755 --- a/opera/openo_connect.py +++ b/opera/openo_connect.py @@ -13,6 +13,7 @@ import sys import os import time import requests +import re import json from datetime import datetime from pprint import pprint @@ -86,6 +87,19 @@ def get_vim_id(msb_ip, vim_type): return vimId +def get_vnfm_ip(msb_ip): + vnfm_url = 'http://' + msb_ip + '/openoapi/extsys/v1/vnfms/' + get_vnfm = request_get(vnfm_url) + vnfm_url = '' + for i in get_vnfm: + if i["type"] == "jujuvnfm": + vnfm_url = i["url"] + break + ip = re.compile("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}") + vnfm_ip = re.findall(ip, vnfm_url)[0] + return vnfm_ip + + def add_openo_vim(msb_ip, auth_url): vim_url = 'http://' + msb_ip + '/openoapi/extsys/v1/vims/' vnfm_url = 'http://' + msb_ip + '/openoapi/extsys/v1/vnfms/' |