from sfa.util.rspec import *
from sfa.util.specdict import *
from sfa.util.faults import *
from sfa.util.rspec import *
from sfa.util.specdict import *
from sfa.util.faults import *
- def __init__(self, api, ttl = 1, caller_cred=None):
+ def __init__(self, api, ttl = 1, origin_hrn=None):
filename = ".".join([self.api.interface, self.api.hrn, "nodes"])
filepath = path + os.sep + filename
self.nodes_file = filepath
SimpleStorage.__init__(self, self.nodes_file)
self.policy = Policy(api)
self.load()
filename = ".".join([self.api.interface, self.api.hrn, "nodes"])
filepath = path + os.sep + filename
self.nodes_file = filepath
SimpleStorage.__init__(self, self.nodes_file)
self.policy = Policy(api)
self.load()
- def get_remote_resources(self, hrn = None):
+ def get_rspec_smgr(self, xrn = None):
+ hrn, type = urn_to_hrn(xrn)
# convert and threshold to ints
if self.has_key('timestamp') and self['timestamp']:
hr_timestamp = self['timestamp']
# convert and threshold to ints
if self.has_key('timestamp') and self['timestamp']:
hr_timestamp = self['timestamp']
- agg_rspec = aggregates[aggregate].get_resources(credential, hrn, request_hash, caller_cred)
+ agg_rspec = aggregates[aggregate].get_resources(credential, xrn, origin_hrn)
# extract the netspec from each aggregates rspec
rspec.parseString(agg_rspec)
networks.extend([{'NetSpec': rspec.getDictsByTagName('NetSpec')}])
# extract the netspec from each aggregates rspec
rspec.parseString(agg_rspec)
networks.extend([{'NetSpec': rspec.getDictsByTagName('NetSpec')}])
print >> log, "%s" % (traceback.format_exc())
# create the rspec dict
resources = {'networks': networks, 'start_time': start_time, 'duration': duration}
print >> log, "%s" % (traceback.format_exc())
# create the rspec dict
resources = {'networks': networks, 'start_time': start_time, 'duration': duration}
# filter according to policy
blist = self.policy['node_blacklist']
wlist = self.policy['node_whitelist']
# filter according to policy
blist = self.policy['node_blacklist']
wlist = self.policy['node_whitelist']
- return self.get_rspec_aggregate(hrn)
-
- def get_rspec_smgr(self, hrn = None):
-
- rspec = self.get_remote_resources(hrn)
- return rspec.toxml()
+ return self.get_rspec_aggregate(xrn)
# Filter out whitelisted nodes
public_nodes = lambda n: n.has_key('slice_ids_whitelist') and not n['slice_ids_whitelist']
# Filter out whitelisted nodes
public_nodes = lambda n: n.has_key('slice_ids_whitelist') and not n['slice_ids_whitelist']
elif self.api.plshell_version in ['4.3']:
interfaces = self.api.plshell.GetInterfaces(self.api.plauth, interface_ids)
else:
elif self.api.plshell_version in ['4.3']:
interfaces = self.api.plshell.GetInterfaces(self.api.plauth, interface_ids)
else:
resources = {'networks': networks, 'start_time': start_time, 'duration': duration}
# convert the plc dict to an rspec dict
resources = {'networks': networks, 'start_time': start_time, 'duration': duration}
# convert the plc dict to an rspec dict