from sfa.util.sfalogging import logger
#from sfa.util.sfalogging import sfa_logger
-from sfa.util.rspecHelper import merge_rspecs
+#from sfa.util.rspecHelper import merge_rspecs
from sfa.util.xrn import Xrn, urn_to_hrn, hrn_to_urn
from sfa.util.plxrn import hrn_to_pl_slicename
-from sfa.util.rspec import *
-from sfa.util.specdict import *
+#from sfa.util.rspec import *
+#from sfa.util.specdict import *
from sfa.util.faults import *
from sfa.util.record import SfaRecord
#from sfa.rspecs.pg_rspec import PGRSpec
from sfa.client.client_helper import sfa_to_pg_users_arg
from sfa.rspecs.version_manager import VersionManager
-from sfa.rspecs.rspec import RSpec
+#from sfa.rspecs.rspec import RSpec
from sfa.util.policy import Policy
from sfa.util.prefixTree import prefixTree
-from sfa.util.sfaticket import *
+#from sfa.util.sfaticket import *
from sfa.trust.credential import Credential
-from sfa.util.threadmanager import ThreadManager
-import sfa.util.xmlrpcprotocol as xmlrpcprotocol
-import sfa.plc.peers as peers
+#from sfa.util.threadmanager import ThreadManager
+#import sfa.util.xmlrpcprotocol as xmlrpcprotocol
+#import sfa.plc.peers as peers
from sfa.util.version import version_core
from sfa.util.callids import Callids
+#from sfa.senslab.api import *
+
+
+#api=SfaAPI(interface='slicemgr')
def _call_id_supported(api, server):
"""
def CreateSliver(api, xrn, creds, rspec_str, users, call_id):
+
version_manager = VersionManager()
- def _CreateSliver(aggregate, xrn, credential, rspec, users, call_id):
- # Need to call ParseVersion at an aggregate to determine the supported
- # rspec type/format beofre calling CreateSliver at an Aggregate.
- # The Aggregate's verion info is cached
+ def _CreateSliver(aggregate, server, xrn, credential, rspec, users, call_id):
tStart = time.time()
try:
# Need to call GetVersion at an aggregate to determine the supported
# rspec type/format beofre calling CreateSliver at an Aggregate.
+ print>>sys.stderr, " \r\n SLICE MANAGERSLAB _CreateSliver server "
server_version = api.get_cached_server_version(server)
requested_users = users
if 'sfa' not in server_version and 'geni_api' in server_version:
credential = api.getDelegatedCredential(creds)
if not credential:
credential = api.getCredential()
-
+
# get the callers hrn
hrn, type = urn_to_hrn(xrn)
valid_cred = api.auth.checkCredentials(creds, 'createsliver', hrn)[0]
caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
threads = ThreadManager()
-
+ print>>sys.stderr, " \r\n \r\n \t\t =======SLICE MANAGER _CreateSliver api aggregates %s \t caller_hrn %s api.hrn %s" %(api.aggregates, caller_hrn, api.hrn)
for aggregate in api.aggregates:
# prevent infinite loop. Dont send request back to caller
# unless the caller is the aggregate's SM
if caller_hrn == aggregate and aggregate != api.hrn:
continue
interface = api.aggregates[aggregate]
- server = api.get_server(interface, credential)
+ print>>sys.stderr, " \r\n \r\n \t\t =======SLICE MANAGER _CreateSliver aggregate %s interface %s" %(api.aggregates[aggregate],interface)
+ server = api.get_server(interface, credential)
+ if server is None:
+ print>>sys.stderr, " \r\n \r\n \t\t =======SLICE MANAGER _CreateSliver NOSERVERS "
# Just send entire RSpec to each aggregate
- threads.run(_CreateSliver, aggregate, xrn, [credential], rspec.toxml(), users, call_id)
-
+ #threads.run(_CreateSliver, aggregate, xrn, [credential], rspec.toxml(), users, call_id)
+ threads.run(_CreateSliver, aggregate, server, xrn, [credential], rspec.toxml(), users, call_id)
results = threads.get_results()
manifest_version = version_manager._get_version(rspec.version.type, rspec.version.version, 'manifest')
result_rspec = RSpec(version=manifest_version)