def main(): # Generate command line parser parser = OptionParser(usage="sfa-server [options]") parser.add_option( "-r", "--registry", dest="registry", action="store_true", help="run registry server", default=False ) parser.add_option("-s", "--slicemgr", dest="sm", action="store_true", help="run slice manager", default=False) parser.add_option("-a", "--aggregate", dest="am", action="store_true", help="run aggregate manager", default=False) parser.add_option("-c", "--component", dest="cm", action="store_true", help="run component server", default=False) parser.add_option( "-t", "--trusted-certs", dest="trusted_certs", action="store_true", help="refresh trusted certs", default=False ) parser.add_option("-v", "--verbose", action="count", dest="verbose", default=0, help="verbose mode - cumulative") parser.add_option("-d", "--daemon", dest="daemon", action="store_true", help="Run as daemon.", default=False) (options, args) = parser.parse_args() config = Config() if config.SFA_API_DEBUG: pass hierarchy = Hierarchy() server_key_file = os.path.join(hierarchy.basedir, "server.key") server_cert_file = os.path.join(hierarchy.basedir, "server.cert") init_server_key(server_key_file, server_cert_file, config, hierarchy) init_server(options, config) if options.daemon: daemon() if options.trusted_certs: install_peer_certs(server_key_file, server_cert_file) # start registry server if options.registry: from sfa.server.registry import Registry r = Registry("", config.SFA_REGISTRY_PORT, server_key_file, server_cert_file) r.start() if options.am: from sfa.server.aggregate import Aggregate a = Aggregate("", config.SFA_AGGREGATE_PORT, server_key_file, server_cert_file) a.start() # start slice manager if options.sm: from sfa.server.slicemgr import SliceMgr s = SliceMgr("", config.SFA_SM_PORT, server_key_file, server_cert_file) s.start() if options.cm: from sfa.server.component import Component c = Component("", config.component_port, server_key_file, server_cert_file) # c = Component("", config.SFA_COMPONENT_PORT, server_key_file, server_cert_file) c.start()
def main(): # Generate command line parser parser = OptionParser(usage="sfa-start.py [options]") parser.add_option("-r", "--registry", dest="registry", action="store_true", help="run registry server", default=False) parser.add_option("-s", "--slicemgr", dest="sm", action="store_true", help="run slice manager", default=False) parser.add_option("-a", "--aggregate", dest="am", action="store_true", help="run aggregate manager", default=False) parser.add_option("-c", "--component", dest="cm", action="store_true", help="run component server", default=False) parser.add_option("-t", "--trusted-certs", dest="trusted_certs", action="store_true", help="refresh trusted certs", default=False) parser.add_option("-d", "--daemon", dest="daemon", action="store_true", help="Run as daemon.", default=False) (options, args) = parser.parse_args() config = Config() logger.setLevelFromOptVerbose(config.SFA_API_LOGLEVEL) # ge the server's key and cert hierarchy = Hierarchy() auth_info = hierarchy.get_interface_auth_info() server_key_file = auth_info.get_privkey_filename() server_cert_file = auth_info.get_gid_filename() # ensure interface cert is present in trusted roots dir trusted_roots = TrustedRoots(config.get_trustedroots_dir()) trusted_roots.add_gid(GID(filename=server_cert_file)) if (options.daemon): daemon() if options.trusted_certs: install_peer_certs(server_key_file, server_cert_file) # start registry server if (options.registry): from sfa.server.registry import Registry r = Registry("", config.SFA_REGISTRY_PORT, server_key_file, server_cert_file) r.start() if (options.am): from sfa.server.aggregate import Aggregate a = Aggregate("", config.SFA_AGGREGATE_PORT, server_key_file, server_cert_file) a.start() # start slice manager if (options.sm): from sfa.server.slicemgr import SliceMgr s = SliceMgr("", config.SFA_SM_PORT, server_key_file, server_cert_file) s.start() if (options.cm): from sfa.server.component import Component c = Component("", config.component_port, server_key_file, server_cert_file) # c = Component("", config.SFA_COMPONENT_PORT, server_key_file, server_cert_file) c.start()