2 # Registry is a SfaServer that implements the Registry interface
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
17 # Registry is a SfaServer that serves registry and slice operations at PLC.
18 class Registry(SfaServer):
20 # Create a new registry object.
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)
27 def __init__(self, ip, port, key_file, cert_file):
28 SfaServer.__init__(self, ip, port, key_file, cert_file,'registry')
31 # Registries is a dictionary of registry connections keyed on the registry
34 class Registries(Interfaces):
36 default_dict = {'registries': {'registry': [Interfaces.default_fields]}}
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'),
48 self.interfaces[self.api.hrn] = local_registry
51 self.update(self.get_connections())