Revert "Remove unused methods"
This reverts commit 9e9a923448e6673fc0396265732115b55f1df9da.
Change-Id: I1d8868ed98d83d22da2acbfa3963543ea9dd95ca
Signed-off-by: Gabriel Cuba <gcuba@whitestack.com>
diff --git a/osm_lcm/data_utils/database/wim_account.py b/osm_lcm/data_utils/database/wim_account.py
index 8c958c1..a1f1799 100644
--- a/osm_lcm/data_utils/database/wim_account.py
+++ b/osm_lcm/data_utils/database/wim_account.py
@@ -33,6 +33,16 @@
cls.db = Database().instance.db
@classmethod
+ def get_wim_account_with_id(cls, wim_account_id):
+ if not cls.db:
+ cls.initialize_db()
+ if wim_account_id in cls.db_wims:
+ return cls.db_wims[wim_account_id]
+ db_wim = cls.db.get_one("wim_accounts", {"_id": wim_account_id}) or {}
+ cls.db_wims[wim_account_id] = db_wim
+ return db_wim
+
+ @classmethod
def get_all_wim_accounts(cls):
if not cls.db:
cls.initialize_db()
diff --git a/osm_lcm/data_utils/nsd.py b/osm_lcm/data_utils/nsd.py
index d436e1f..9b6fb81 100644
--- a/osm_lcm/data_utils/nsd.py
+++ b/osm_lcm/data_utils/nsd.py
@@ -21,6 +21,7 @@
# For those usages not covered by the Apache License, Version 2.0 please
# contact: fbravo@whitestack.com
##
+import ast
from osm_lcm.data_utils.list_utils import find_in_list
@@ -40,6 +41,12 @@
return nsd.get("df")[0].get("virtual-link-profile", ())
+def replace_vnf_id(nsd, old_vnf_id, new_vnf_id):
+ dict_str = str(nsd)
+ dict_str.replace(old_vnf_id, new_vnf_id)
+ return ast.literal_eval(dict_str)
+
+
def get_ns_configuration(nsd):
return nsd.get("ns-configuration", {})
diff --git a/osm_lcm/data_utils/nsr.py b/osm_lcm/data_utils/nsr.py
index 9b0570c..f2fccb6 100644
--- a/osm_lcm/data_utils/nsr.py
+++ b/osm_lcm/data_utils/nsr.py
@@ -26,6 +26,10 @@
from osm_lcm.lcm_utils import get_iterable
+def get_vlds(nsr):
+ return nsr.get("vld", ())
+
+
def get_deployed_kdu(nsr_deployed, kdu_name, member_vnf_index):
deployed_kdu = None
index = None
diff --git a/osm_lcm/data_utils/vnfd.py b/osm_lcm/data_utils/vnfd.py
index 954a84c..9f8104a 100644
--- a/osm_lcm/data_utils/vnfd.py
+++ b/osm_lcm/data_utils/vnfd.py
@@ -25,6 +25,10 @@
from osm_lcm.data_utils import list_utils
+def get_lcm_operations_configuration(vnfd):
+ return vnfd.get("df", ())[0].get("lcm-operations-configuration", ())
+
+
def get_vdu_list(vnfd):
return vnfd.get("vdu", ())
diff --git a/osm_lcm/data_utils/vnfr.py b/osm_lcm/data_utils/vnfr.py
index 653a7ed..fc64145 100644
--- a/osm_lcm/data_utils/vnfr.py
+++ b/osm_lcm/data_utils/vnfr.py
@@ -22,9 +22,14 @@
# contact: fbravo@whitestack.com
##
+from osm_lcm.data_utils import list_utils
from osm_lcm.lcm_utils import get_iterable
+def find_VNFR_by_VDU_ID(vnfr, vdu_id):
+ list_utils.find_in_list(vnfr, lambda vnfr: False)
+
+
def get_osm_params(db_vnfr, vdu_id=None, vdu_count_index=0):
osm_params = {
x.replace("-", "_"): db_vnfr[x]