- ValidCreds = self.api.auth.checkCredentials(creds, 'createsliver', hrn)
- origin_hrn = Credential(string=ValidCreds[0]).get_gid_caller().get_hrn()
-
- manager_base = 'sfa.managers'
-
- if self.api.interface in ['geni_am']:
- mgr_type = self.api.config.SFA_GENI_AGGREGATE_TYPE
- manager_module = manager_base + ".geni_am_%s" % mgr_type
- manager = __import__(manager_module, fromlist=[manager_base])
- rspec = self.__run_sfatables(manager, SFATablesRules('INCOMING'),
- hrn, origin_hrn, rspec)
-
-
- allocated = manager.CreateSliver(self.api, slice_xrn, ValidCreds, rspec, users)
- if allocated:
- return rspec
-
- return ''
-
+ valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', hrn)
+ origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
+
+ # make sure users info is specified
+ if not users:
+ msg = "'users' must be specified and cannot be null. You may need to update your client."
+ raise SfaInvalidArgument(name='users', extra=msg)
+
+ # flter rspec through sfatables
+ if self.api.interface in ['aggregate']:
+ chain_name = 'INCOMING'
+ elif self.api.interface in ['slicemgr']:
+ chain_name = 'FORWARD-INCOMING'
+ self.api.logger.debug("CreateSliver: sfatables on chain %s"%chain_name)
+ rspec = run_sfatables(chain_name, hrn, origin_hrn, rspec)
+ slivers = RSpec(rspec).version.get_nodes_with_slivers()
+ if not slivers:
+ raise InvalidRSpec("Missing <sliver_type> or <sliver> element. Request rspec must explicitly allocate slivers")
+ result = self.api.manager.CreateSliver(self.api, slice_xrn, creds, rspec, users, options)
+ return result