namespace module is gone, plxrn provides PL-specific translations
[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.util.xrn import hrn_to_urn
11 from sfa.server.interface import Interfaces
12 import sfa.util.xmlrpcprotocol as xmlrpcprotocol
13 import sfa.util.soapprotocol as soapprotocol
14  
15
16 ##
17 # Registry is a SfaServer that serves registry and slice operations at PLC.
18 class Registry(SfaServer):
19     ##
20     # Create a new registry object.
21     #
22     # @param ip the ip address to listen on
23     # @param port the port to listen on
24     # @param key_file private key filename of registry
25     # @param cert_file certificate filename containing public key (could be a GID file)
26     
27     def __init__(self, ip, port, key_file, cert_file):
28         SfaServer.__init__(self, ip, port, key_file, cert_file,'registry')
29
30 ##
31 # Registries is a dictionary of registry connections keyed on the registry
32 # hrn
33
34 class Registries(Interfaces):
35     
36     default_dict = {'registries': {'registry': [Interfaces.default_fields]}}
37
38     def __init__(self, api, conf_file = "/etc/sfa/registries.xml"):
39         Interfaces.__init__(self, api, conf_file) 
40         address = self.api.config.SFA_REGISTRY_HOST
41         port = self.api.config.SFA_REGISTRY_PORT
42         url = 'http://%(address)s:%(port)s' % locals()
43         local_registry = {'hrn': self.api.hrn,
44                            'urn': hrn_to_urn(self.api.hrn, 'authority'),
45                            'addr': address,
46                            'port': port,
47                            'url': url}
48         self.interfaces[self.api.hrn] = local_registry
49        
50         # get connections
51         self.update(self.get_connections())