import types
import time
-from sfa.server.registry import Registries
from sfa.util.prefixTree import prefixTree
from sfa.util.record import SfaRecord
from sfa.util.table import SfaTable
# create a dict whre key is an registry hrn and its value is a
# hrns at that registry (determined by the known prefix tree).
xrn_dict = {}
- # XX Preload this into the api module
- registries = Registries(api)
+ registries = api.registries
tree = prefixTree()
registry_hrns = registries.keys()
tree.load(registry_hrns)
# load all know registry names into a prefix tree and attempt to find
# the longest matching prefix
records = []
- registries = Registries(api)
+ registries = api.registries
registry_hrns = registries.keys()
tree = prefixTree()
tree.load(registry_hrns)
type = record['type']
credential = api.getCredential()
- registries = Registries(api)
+ registries = api.registries
# Try to remove the object from the PLCDB of federated agg.
# This is attempted before removing the object from the local agg's PLCDB and sfa table
from sfa.util.rspec import *
from sfa.util.sfaticket import *
from sfa.util.debug import log
-from sfa.server.registry import Registries
-from sfa.server.aggregate import Aggregates
import sfa.plc.peers as peers
def delete_slice(api, xrn, origin_hrn=None):
credential = api.getCredential()
- aggregates = Aggregates(api)
+ aggregates = api.aggregates
for aggregate in aggregates:
success = False
# request hash is optional so lets try the call without it
message = "%s (line %s)" % (error.message, error.line)
raise InvalidRSpec(message)
- aggs = Aggregates(api)
+ aggs = api.aggregates
cred = api.getCredential()
for agg in aggs:
if agg not in [api.auth.client_cred.get_gid_caller().get_hrn()]:
rspecs[net_hrn] = temp_rspec.toxml()
# send the rspec to the appropiate aggregate/sm
- aggregates = Aggregates(api)
+ aggregates = api.aggregates
credential = api.getCredential()
tickets = {}
for net_hrn in rspecs:
hrn, type = urn_to_hrn(xrn)
rspec = None
- aggs = Aggregates(api)
+ aggs = api.aggregates
cred = api.getCredential()
for agg in aggs:
if agg not in [api.auth.client_cred.get_gid_caller().get_hrn()]:
from sfa.util.rspec import *
from sfa.util.specdict import *
from sfa.util.policy import Policy
-from sfa.server.aggregate import Aggregates
class Nodes(SimpleStorage):
end_time = int(threshold.strftime("%s"))
duration = end_time - start_time
- aggregates = Aggregates(self.api)
+ aggregates = self.api.aggregates
rspecs = {}
networks = []
rspec = RSpec()
from sfa.util.policy import Policy
from sfa.util.prefixTree import prefixTree
from sfa.util.debug import log
-from sfa.server.aggregate import Aggregates
-from sfa.server.registry import Registries
MAXINT = 2L**31-1
def refresh_slices_smgr(self):
slice_hrns = []
- aggregates = Aggregates(self.api)
credential = self.api.getCredential()
- for aggregate in aggregates:
+ for aggregate in self.api.aggregates:
success = False
- # request hash is optional so lets try the call without it
try:
- slices = aggregates[aggregate].get_slices(credential)
+ slices = self.api.aggregates[aggregate].get_slices(credential)
slice_hrns.extend(slices)
success = True
except:
print >> log, "%s" % (traceback.format_exc())
print >> log, "Error calling slices at aggregate %(aggregate)s" % locals()
- # try sending the request hash if the previous call failed
- if not success:
- arg_list = [credential]
- try:
- slices = aggregates[aggregate].get_slices(credential)
- slice_hrns.extend(slices)
- success = True
- except:
- print >> log, "%s" % (traceback.format_exc())
- print >> log, "Error calling slices at aggregate %(aggregate)s" % locals()
-
# update timestamp and threshold
timestamp = datetime.datetime.now()
hr_timestamp = timestamp.strftime(self.api.time_format)
slicename = hrn_to_pl_slicename(hrn)
slice = {}
slice_record = None
- registries = Registries(self.api)
- registry = registries[self.api.hrn]
+ registry = self.api.registries[self.api.hrn]
credential = self.api.getCredential()
site_id, remote_site_id = self.verify_site(registry, credential, hrn, peer, sfa_peer)