+def main():
+ # xxx get rid of globals - name consistently CamelCase or under_score
+ global AuthHierarchy
+ global TrustedRoots
+ global registry_port
+ global aggregate_port
+ global slicemgr_port
+
+ # 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("-v", "--verbose", dest="verbose", action="store_true",
+ help="verbose mode", default=False)
+ parser.add_option("-d", "--daemon", dest="daemon", action="store_true",
+ help="Run as daemon.", default=False)
+ (options, args) = parser.parse_args()
+
+ if (options.daemon): daemon()
+
+ config = Config()
+ hierarchy = Hierarchy()
+ trusted_roots = TrustedRootList(config.get_trustedroots_dir())
+ 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)
+