trimmed useless imports, unstarred all imports
[sfa.git] / sfa / server / registry.py
1 #
2 # Registry is a SfaServer that implements the Registry interface
3 #
4 from sfa.server.sfaserver import SfaServer
5 from sfa.server.interface import Interfaces, Interface
6 from sfa.util.config import Config 
7
8 ##
9 # Registry is a SfaServer that serves registry and slice operations at PLC.
10 class Registry(SfaServer):
11     ##
12     # Create a new registry object.
13     #
14     # @param ip the ip address to listen on
15     # @param port the port to listen on
16     # @param key_file private key filename of registry
17     # @param cert_file certificate filename containing public key (could be a GID file)
18     
19     def __init__(self, ip, port, key_file, cert_file):
20         SfaServer.__init__(self, ip, port, key_file, cert_file,'registry')
21
22 ##
23 # Registries is a dictionary of registry connections keyed on the registry
24 # hrn
25
26 class Registries(Interfaces):
27     
28     default_dict = {'registries': {'registry': [Interfaces.default_fields]}}
29
30     def __init__(self, conf_file = "/etc/sfa/registries.xml"):
31         Interfaces.__init__(self, conf_file) 
32         sfa_config = Config() 
33         if sfa_config.SFA_REGISTRY_ENABLED:
34             addr = sfa_config.SFA_REGISTRY_HOST
35             port = sfa_config.SFA_REGISTRY_PORT
36             hrn = sfa_config.SFA_INTERFACE_HRN
37             interface = Interface(hrn, addr, port)
38             self[hrn] = interface