trimmed useless imports, unstarred all imports
[sfa.git] / sfa / server / aggregate.py
1 from sfa.server.sfaserver import SfaServer
2 from sfa.util.xrn import hrn_to_urn
3 from sfa.server.interface import Interfaces, Interface
4 from sfa.util.config import Config     
5
6 class Aggregate(SfaServer):
7
8     ##
9     # Create a new aggregate object.
10     #
11     # @param ip the ip address to listen on
12     # @param port the port to listen on
13     # @param key_file private key filename of registry
14     # @param cert_file certificate filename containing public key (could be a GID file)     
15     def __init__(self, ip, port, key_file, cert_file):
16         SfaServer.__init__(self, ip, port, key_file, cert_file,'aggregate')
17
18 ##
19 # Aggregates is a dictionary of aggregate connections keyed on the aggregate hrn
20
21 class Aggregates(Interfaces):
22
23     default_dict = {'aggregates': {'aggregate': [Interfaces.default_fields]}}
24  
25     def __init__(self, conf_file = "/etc/sfa/aggregates.xml"):
26         Interfaces.__init__(self, conf_file)
27         sfa_config = Config() 
28         # set up a connection to the local aggregate
29         if sfa_config.SFA_AGGREGATE_ENABLED:
30             addr = sfa_config.SFA_AGGREGATE_HOST
31             port = sfa_config.SFA_AGGREGATE_PORT
32             hrn = sfa_config.SFA_INTERFACE_HRN
33             interface = Interface(hrn, addr, port)
34             self[hrn] = interface