X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fdata_utils%2Fvnfr.py;h=9c0b14826df4c86382bb35d44e210885a32e9160;hb=f0f83a3ca9d8a94e464721ca0d99c5ff5d47f405;hp=042788e2042869d76a761c20f4fdda659556e7ec;hpb=762b6e7182f5bbba4b4206b12204e77bd45c3d33;p=osm%2FLCM.git diff --git a/osm_lcm/data_utils/vnfr.py b/osm_lcm/data_utils/vnfr.py index 042788e..9c0b148 100644 --- a/osm_lcm/data_utils/vnfr.py +++ b/osm_lcm/data_utils/vnfr.py @@ -23,6 +23,7 @@ ## 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): @@ -57,3 +58,11 @@ def get_osm_params(db_vnfr, vdu_id=None, vdu_count_index=0): osm_params["vdu_id"] = vdu_id osm_params["count_index"] = vdu_count_index return osm_params + + +def get_vdur_index(db_vnfr, vdu_delta): + vdur_list = get_iterable(db_vnfr, "vdur") + if vdur_list: + return len([x for x in vdur_list if x.get("vdu-id-ref") == vdu_delta["id"]]) + else: + return 0