From 4867ce93ff214e5bcb1b3b178173080a17bfc5dd Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Fri, 17 Mar 2017 17:23:17 +0800 Subject: add get_vnfm_ip add function get_vnfm_ip to get juju client vm ip Change-Id: Ib78d81ab2bb54ecc197581913c5127235bc563da Signed-off-by: Harry Huang --- opera/__init__.py | 0 opera/deploy_vnf.py | 0 opera/openo_connect.py | 14 ++++++++++++++ 3 files changed, 14 insertions(+) create mode 100644 opera/__init__.py mode change 100644 => 100755 opera/deploy_vnf.py diff --git a/opera/__init__.py b/opera/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/opera/deploy_vnf.py b/opera/deploy_vnf.py old mode 100644 new mode 100755 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/' -- cgit 1.2.3-korg