Introduce deprecating methods
Change-Id: Ic35d8596631cc6c30ea9e54a1144c6d6c08e6e79
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/osm_ro/vmwarerecli.py b/deprecated/vmwarerecli.py
similarity index 100%
rename from osm_ro/vmwarerecli.py
rename to deprecated/vmwarerecli.py
diff --git a/docker/Dockerfile-local b/docker/Dockerfile-local
index b1ad102..3847032 100644
--- a/docker/Dockerfile-local
+++ b/docker/Dockerfile-local
@@ -67,7 +67,8 @@
RO_DB_PORT=3306 \
RO_DB_OVIM_PORT=3306 \
RO_DB_NAME=mano_db \
- RO_DB_OVIM_NAME=mano_vim_db
+ RO_DB_OVIM_NAME=mano_vim_db \
+ OPENMANO_TENANT=osm
CMD /bin/RO/start.sh
diff --git a/osm_ro/nfvo.py b/osm_ro/nfvo.py
index 0241323..98463ea 100644
--- a/osm_ro/nfvo.py
+++ b/osm_ro/nfvo.py
@@ -31,6 +31,7 @@
# import json
import yaml
import utils
+from utils import deprecated
import vim_thread
from db_base import HTTP_Unauthorized, HTTP_Bad_Request, HTTP_Internal_Server_Error, HTTP_Not_Found,\
HTTP_Conflict, HTTP_Method_Not_Allowed
@@ -1305,6 +1306,7 @@
raise # NfvoException("Exception {}".format(e), HTTP_Bad_Request)
+@deprecated("Use new_vnfd_v3")
def new_vnf(mydb, tenant_id, vnf_descriptor):
global global_config
@@ -1442,6 +1444,7 @@
raise NfvoException(error_text, e.http_code)
+@deprecated("Use new_vnfd_v3")
def new_vnf_v02(mydb, tenant_id, vnf_descriptor):
global global_config
@@ -1742,6 +1745,7 @@
# return "delete_vnf. Undeleted: %s" %(undeletedItems)
+@deprecated("Not used")
def get_hosts_info(mydb, nfvo_tenant_id, datacenter_name=None):
result, vims = get_vim(mydb, nfvo_tenant_id, None, datacenter_name)
if result < 0:
@@ -1792,6 +1796,7 @@
raise NfvoException("Not possible to get_host_list from VIM: {}".format(str(e)), e.http_code)
+@deprecated("Use new_nsd_v3")
def new_scenario(mydb, tenant_id, topo):
# result, vims = get_vim(mydb, tenant_id)
@@ -2073,6 +2078,7 @@
return c
+@deprecated("Use new_nsd_v3")
def new_scenario_v02(mydb, tenant_id, scenario_dict, version):
""" This creates a new scenario for version 0.2 and 0.3"""
scenario = scenario_dict["scenario"]
@@ -2518,6 +2524,7 @@
return c
+@deprecated("Use create_instance")
def start_scenario(mydb, tenant_id, scenario_id, instance_scenario_name, instance_scenario_description, datacenter=None,vim_tenant=None, startvms=True):
#print "Checking that nfvo_tenant_id exists and getting the VIM URI and the VIM tenant_id"
datacenter_id, myvim = get_datacenter_by_name_uuid(mydb, tenant_id, datacenter, vim_tenant=vim_tenant)
@@ -4118,6 +4125,7 @@
}
return instance_dict
+@deprecated("Instance is automatically refreshed by vim_threads")
def refresh_instance(mydb, nfvo_tenant, instanceDict, datacenter=None, vim_tenant=None):
'''Refreshes a scenario instance. It modifies instanceDict'''
'''Returns:
diff --git a/osm_ro/utils.py b/osm_ro/utils.py
index c7d966e..2ae062f 100644
--- a/osm_ro/utils.py
+++ b/osm_ro/utils.py
@@ -30,6 +30,7 @@
__date__ ="$08-sep-2014 12:21:22$"
import datetime
+import warnings
from jsonschema import validate as js_v, exceptions as js_e
#from bs4 import BeautifulSoup
@@ -196,3 +197,14 @@
for char in text[start+1:end]:
text_list += expand_brackets(text[:start] + char + text[end+1:])
return text_list
+
+def deprecated(message):
+ def deprecated_decorator(func):
+ def deprecated_func(*args, **kwargs):
+ warnings.warn("{} is a deprecated function. {}".format(func.__name__, message),
+ category=DeprecationWarning,
+ stacklevel=2)
+ warnings.simplefilter('default', DeprecationWarning)
+ return func(*args, **kwargs)
+ return deprecated_func
+ return deprecated_decorator
\ No newline at end of file