from sfa.util.faults import SfaAPIError
# for convenience and smoother translation - we should get rid of these functions eventually
from sfa.util.faults import SfaAPIError
# for convenience and smoother translation - we should get rid of these functions eventually
# A better alternative than childHRN.startswith(parentHRN)
# e.g. hrn_is_auth_for_hrn('a\.b', 'a\.b.c.d') -> True,
# but hrn_is_auth_for_hrn('a', 'a\.b.c.d') -> False
# A better alternative than childHRN.startswith(parentHRN)
# e.g. hrn_is_auth_for_hrn('a\.b', 'a\.b.c.d') -> True,
# but hrn_is_auth_for_hrn('a', 'a\.b.c.d') -> False
# provide either urn, or (hrn + type)
def __init__ (self, xrn, type=None):
if not xrn: xrn = ""
# provide either urn, or (hrn + type)
def __init__ (self, xrn, type=None):
if not xrn: xrn = ""
# self.authority keeps a list
if not hasattr(self,'authority'):
self.authority=Xrn.hrn_auth_list(self.hrn)
# self.authority keeps a list
if not hasattr(self,'authority'):
self.authority=Xrn.hrn_auth_list(self.hrn)
-
- def get_sliver_id(self, slice_id, node_id, index=0, authority=None):
+
+ def get_sliver_id(self, slice_id, node_id=None, index=0, authority=None):
- return ":".join(map(str, [urn, slice_id, node_id, index]))
-
+ parts = [part for part in [urn, slice_id, node_id, index] if part is not None]
+ return ":".join(map(str, [parts]))
+