X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=blobdiff_plain;f=NG-RO%2Fosm_ng_ro%2Fns.py;fp=NG-RO%2Fosm_ng_ro%2Fns.py;h=a7c1562861c26c891f40933513554423d265fdfb;hp=096d4dfd16acc06a7508b49dc0cf8cebba7d2a83;hb=6585ea3e5a2b68ed7ca3afb72ec816cb841f624d;hpb=4e86d0ca6f191d698fff7e35aacff887ed7c616c diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py index 096d4dfd..a7c15628 100644 --- a/NG-RO/osm_ng_ro/ns.py +++ b/NG-RO/osm_ng_ro/ns.py @@ -1087,7 +1087,11 @@ class Ns(object): # If the position info is provided for all the interfaces, it will be sorted # according to position number ascendingly. - if all(i.get("position") for i in target_vdu["interfaces"]): + if all( + i.get("position") + 1 + for i in target_vdu["interfaces"] + if i.get("position") is not None + ): sorted_interfaces = sorted( target_vdu["interfaces"], key=lambda x: (x.get("position") is None, x.get("position")), @@ -1097,7 +1101,11 @@ class Ns(object): # If the position info is provided for some interfaces but not all of them, the interfaces # which has specific position numbers will be placed and others' positions will not be taken care. else: - if any(i.get("position") for i in target_vdu["interfaces"]): + if any( + i.get("position") + 1 + for i in target_vdu["interfaces"] + if i.get("position") is not None + ): n = len(target_vdu["interfaces"]) sorted_interfaces = [-1] * n k, m = 0, 0