8 def set_tree_globals(tree1, tree2):
11 global_sr_tree = tree1
12 global_cr_tree = tree2
14 def get_tree_globals():
15 return (global_sr_tree, global_cr_tree)
17 #function converts a hierarchical name from geni format to array of strings
18 def geni_to_arr(name):
21 parts = name.split(".")
22 for i in range(len(parts)):
23 arrayName.append(parts[i])
26 raise MalformedHrnException(name)
28 #used to parse the function name and the parameters specified in "operation_request"
29 def msg_to_params(str):
33 raise InvalidRPCParams(str)
35 #returns the authority hrn of a given 'hrn'
36 def obtain_authority(hrn):
37 parts = hrn.split(".")
40 auth_str = parts[0]+''
41 for i in range(1, len(parts)-1):
42 auth_str = auth_str + '.' + parts[i]
45 #returns the last element of an hrn
47 parts = hrn.split(".")
48 return parts[len(parts)-1]
50 #checks whether the 'hrn_auth' is an authority of 'hrn'
51 def check_authority(hrn, hrn_auth):
52 arr = geni_to_arr(hrn)
53 arr_auth = geni_to_arr(hrn_auth)
55 for i in range(len(arr_auth)):
56 if arr[i] != arr_auth[i]:
62 def hrn_to_tablename(hrn,type):
63 hrn = hrn.replace(".","$")