5 return ".".join(parts[-1:])
7 def get_authority(hrn):
10 return ".".join(parts[:-1])
12 def get_auth_type(type):
13 if (type=="slice") or (type=="user") or (type=="sa"):
15 elif (type=="component") or (type=="ma"):
18 raise UnknownGeniType(type)
20 def hrn_to_pl_slicename(hrn):
21 parts = hrn.split(".")
22 return parts[-2] + "_" + parts[-1]
24 # assuming hrn is the hrn of an authority, return the plc authority name
25 def hrn_to_pl_authname(hrn):
26 parts = hrn.split(".")
29 # assuming hrn is the hrn of an authority, return the plc login_base
30 def hrn_to_pl_login_base(hrn):
31 return hrn_to_pl_authname(hrn)
33 def hostname_to_hrn(self, login_base, hostname):
35 Convert hrn to plantelab name.
37 genihostname = "_".join(hostname.split("."))
38 return ".".join([self.hrn, login_base, genihostname])
40 def slicename_to_hrn(self, slicename):
42 Convert hrn to planetlab name.
44 parts = slicename.split("_")
45 slice_hrn = ".".join([self.hrn, parts[0]]) + "." + "_".join(parts[1:])