2 # Registry is a SfaServer that implements the Registry interface
4 from sfa.server.sfaserver import SfaServer
5 from sfa.server.interface import Interfaces, Interface
6 from sfa.util.config import Config
9 # Registry is a SfaServer that serves registry and slice operations at PLC.
10 # this truly is a server-side object
12 class Registry(SfaServer):
14 # Create a new registry object.
16 # @param ip the ip address to listen on
17 # @param port the port to listen on
18 # @param key_file private key filename of registry
19 # @param cert_file certificate filename containing public key (could be a GID file)
21 def __init__(self, ip, port, key_file, cert_file):
22 SfaServer.__init__(self, ip, port, key_file, cert_file,'registry')
24 if Config().SFA_REGISTRY_ENABLED:
25 from sfa.storage.alchemy import engine
26 from sfa.storage.dbschema import DBSchema
27 DBSchema().init_or_upgrade()
30 # Registries is a dictionary of registry connections keyed on the registry hrn
31 # as such it's more of a client-side thing for registry servers to reach their peers
33 class Registries(Interfaces):
35 default_dict = {'registries': {'registry': [Interfaces.default_fields]}}
37 def __init__(self, conf_file = "/etc/sfa/registries.xml"):
38 Interfaces.__init__(self, conf_file)
40 if sfa_config.SFA_REGISTRY_ENABLED:
41 addr = sfa_config.SFA_REGISTRY_HOST
42 port = sfa_config.SFA_REGISTRY_PORT
43 hrn = sfa_config.SFA_INTERFACE_HRN
44 interface = Interface(hrn, addr, port)