creating tag sfa-0.9-11
[sfa.git] / sfa / server / registry.py
1 #
2 # Registry is a SfaServer that implements the Registry interface
3 #
4 ### $Id$
5 ### $URL$
6 #
7
8 from sfa.util.server import SfaServer
9 from sfa.util.faults import *
10 from sfa.server.interface import Interfaces
11 import sfa.util.xmlrpcprotocol as xmlrpcprotocol
12 import sfa.util.soapprotocol as soapprotocol
13  
14
15 ##
16 # Registry is a SfaServer that serves registry and slice operations at PLC.
17 class Registry(SfaServer):
18     ##
19     # Create a new registry object.
20     #
21     # @param ip the ip address to listen on
22     # @param port the port to listen on
23     # @param key_file private key filename of registry
24     # @param cert_file certificate filename containing public key (could be a GID file)
25     
26     def __init__(self, ip, port, key_file, cert_file):
27         SfaServer.__init__(self, ip, port, key_file, cert_file)
28         self.server.interface = 'registry' 
29
30
31 ##
32 # Registries is a dictionary of registry connections keyed on the registry
33 # hrn
34
35 class Registries(Interfaces):
36     
37     default_dict = {'registries': {'registry': [Interfaces.default_fields]}}
38
39     def __init__(self, api, conf_file = "/etc/sfa/registries.xml"):
40         Interfaces.__init__(self, api, conf_file) 
41         address = self.api.config.SFA_REGISTRY_HOST
42         port = self.api.config.SFA_REGISTRY_PORT
43         url = 'http://%(address)s:%(port)s' % locals()
44         local_registry = {'hrn': self.api.hrn, 'addr': address, 'port': port}
45         self.interfaces[self.api.hrn] = local_registry
46        
47         # get connections
48         self.update(self.get_connections())