aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-03-17 17:23:17 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2017-03-17 17:23:17 +0800
commit4867ce93ff214e5bcb1b3b178173080a17bfc5dd (patch)
tree9a153c7c8f0dfc4974d8cd88b3702507cb845c73
parentf1ef7f43d12751b10314a7e07c3e3ae815057a39 (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>
-rw-r--r--opera/__init__.py0
-rwxr-xr-x[-rw-r--r--]opera/deploy_vnf.py0
-rwxr-xr-xopera/openo_connect.py14
3 files changed, 14 insertions, 0 deletions
diff --git a/opera/__init__.py b/opera/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/opera/__init__.py
diff --git a/opera/deploy_vnf.py b/opera/deploy_vnf.py
index b9703a0..b9703a0 100644..100755
--- a/opera/deploy_vnf.py
+++ b/opera/deploy_vnf.py
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/'