8 return ".".join(parts[-1:])
10 def get_authority(hrn):
12 parts = hrn.split(".")
13 return ".".join(parts[:-1])
15 def hrn_to_pl_slicename(hrn):
16 parts = hrn.split(".")
17 return parts[-2] + "_" + parts[-1]
19 # assuming hrn is the hrn of an authority, return the plc authority name
20 def hrn_to_pl_authname(hrn):
21 parts = hrn.split(".")
24 # assuming hrn is the hrn of an authority, return the plc login_base
25 def hrn_to_pl_login_base(hrn):
26 return hrn_to_pl_authname(hrn)
28 def hostname_to_hrn(auth_hrn, login_base, hostname):
30 Convert hrn to plantelab name.
32 genihostname = "_".join(hostname.split("."))
33 return ".".join([auth_hrn, login_base, genihostname])
35 def slicename_to_hrn(auth_hrn, slicename):
37 Convert hrn to planetlab name.
39 parts = slicename.split("_")
40 slice_hrn = ".".join([auth_hrn, parts[0]]) + "." + "_".join(parts[1:])