X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fnitos%2Fnitosslices.py;h=875a5a90b03ee28ddb9f0be13522f790bb4a256f;hb=4a2337e7f70cef81a8de37829aa63fc941c4b96e;hp=077b0d49880fc3ec3db49791705dc6f1072dace3;hpb=4ba188d2e00ad2ecb5d642c6c442fef500539752;p=sfa.git diff --git a/sfa/nitos/nitosslices.py b/sfa/nitos/nitosslices.py index 077b0d49..875a5a90 100644 --- a/sfa/nitos/nitosslices.py +++ b/sfa/nitos/nitosslices.py @@ -7,7 +7,7 @@ from sfa.util.xrn import Xrn, get_leaf, get_authority, urn_to_hrn from sfa.rspecs.rspec import RSpec -from sfa.nitos.nitosxrn import NitosXrn, hrn_to_nitos_slicename, xrn_to_hostname +from sfa.nitos.nitosxrn import NitosXrn, hrn_to_nitos_slicename, xrn_to_hostname, xrn_to_channel MAXINT = 2L**31-1 @@ -96,7 +96,7 @@ class NitosSlices: slice_name = hrn_to_nitos_slicename(channel['slice_id']) if slice_name != slice['slice_name']: continue - channel_num = channel['channel_num'] + channel_num = xrn_to_channel(channel['component_id']) nitos_channel = self.driver.filter_nitos_results(nitos_channels, {'channel': channel_num})[0] # fill the requested channel with nitos ids requested_channel['slice_id'] = slice['slice_id'] @@ -153,7 +153,8 @@ class NitosSlices: - def verify_slice(self, slice_hrn, slice_record, sfa_peer, options={}): + def verify_slice(self, slice_hrn, slice_record, sfa_peer, options=None): + if options is None: options={} slicename = hrn_to_nitos_slicename(slice_hrn) slices = self.driver.shell.getSlices({}, []) slices = self.driver.filter_nitos_results(slices, {'slice_name': slicename}) @@ -168,7 +169,8 @@ class NitosSlices: return slice - def verify_users(self, slice_hrn, slice_record, users, sfa_peer, options={}): + def verify_users(self, slice_hrn, slice_record, users, sfa_peer, options=None): + if options is None: options={} # get slice info slicename = hrn_to_nitos_slicename(slice_hrn) slices = self.driver.shell.getSlices({}, []) @@ -188,11 +190,11 @@ class NitosSlices: if not nitos_users: # create the user - user_id = self.driver.shell.addUsers({'username': email.split('@')[0], 'email': email}) + user_id = self.driver.shell.addUser({'username': email.split('@')[0], 'email': email}) added_users.append(user_id) # add user keys for key in user['keys']: - self.driver.shell.addUserKey({'user_id': user_id, 'key': key}) + self.driver.shell.addUserKey({'user_id': user_id, 'key': key, 'slice_id': slice['slice_id']}) # add the user to the slice self.driver.shell.addUserToSlice({'slice_id': slice['slice_id'], 'user_id': user_id}) else: @@ -204,7 +206,8 @@ class NitosSlices: return added_users - def verify_keys(self, persons, users, options={}): + def verify_keys(self, persons, users, options=None): + if options is None: options={} # existing keys key_ids = [] for person in persons: