Index: fedd/fedd_experiment_control.py
===================================================================
--- fedd/fedd_experiment_control.py	(revision bf0a80e1c01d765cfb83bf97818bd2fd12eaaf51)
+++ fedd/fedd_experiment_control.py	(revision 34bc05c6025d6e98103f693293f46e80bbb82cd4)
@@ -181,4 +181,5 @@
 	self.exp_stem = "fed-stem"
 	self.log = logging.getLogger("fedd.experiment_control")
+	set_log_level(config, "experiment_control", self.log)
 	self.muxmax = 2
 	self.nthreads = 2
@@ -190,4 +191,5 @@
 	self.ssh_keygen = "/usr/bin/ssh-keygen"
 	self.ssh_identity_file = None
+
 
 	self.debug = config.getboolean("experiment_control", "create_debug")
@@ -208,9 +210,5 @@
 	self.tclsh = "/usr/local/bin/otclsh"
 	self.tcl_splitter = "/usr/testbed/lib/ns2ir/parse.tcl"
-	self.tbmap = { 
-		'deter':'https://users.isi.deterlab.net:23235',
-		'emulab':'https://users.isi.deterlab.net:23236',
-		'ucb':'https://users.isi.deterlab.net:23237',
-		}
+	mapdb_file = config.get("experiment_control", "mapdb")
 	self.trace_file = sys.stderr
 
@@ -229,4 +227,11 @@
 	self.def_gwtype = "pc";
 
+	if auth:
+	    self.auth = auth
+	else:
+	    self.log.error(\
+		    "[access]: No authorizer initialized, creating local one.")
+	    auth = authorizer()
+
 
 	if self.ssh_pubkey_file:
@@ -246,22 +251,18 @@
 		    "No SSH public key file?")
 
-	set_log_level(config, "experiment_control", self.log)
-
-	if auth:
-	    self.auth = auth
+
+	if mapdb_file:
+	    self.read_mapdb(mapdb_file)
+	    print self.tbmap
 	else:
-	    self.log.error(\
-		    "[access]: No authorizer initialized, creating local one.")
-	    auth = authorizer()
+	    self.log.warn("[experiment_control] No testbed map, using defaults")
+	    self.tbmap = { 
+		    'deter':'https://users.isi.deterlab.net:23235',
+		    'emulab':'https://users.isi.deterlab.net:23236',
+		    'ucb':'https://users.isi.deterlab.net:23237',
+		    }
 
 	if accessdb_file:
-	    try:
-		self.accessdb = self.read_accessdb(accessdb_file)
-	    except IOError:
-		raise service_error(service_error.internal,
-			"Error opening %s as experiment control accessdb" % \
-				accessdb_file)
-	    for fid in self.accessdb.keys():
-		self.auth.set_attribute(fid, 'create')
+		self.read_accessdb(accessdb_file)
 	else:
 	    raise service_error(service_error.internal,
@@ -391,5 +392,13 @@
 
     def read_accessdb(self, accessdb_file):
-	access = {}
+	"""
+	Read the mapping from fedids that can create experiments to their name
+	in the 3-level access namespace.  All will be asserted from this
+	testbed and can include the local username and porject that will be
+	asserted on their behalf by this fedd.  Each fedid is also added to the
+	authorization system with the "create" attribute.
+	"""
+	self.accessdb = {}
+	# These are the regexps for parsing the db
 	name_expr = "[" + string.ascii_letters + string.digits + "\.\-]+"
 	project_line = re.compile("^\s*fedid:([" + string.hexdigits + "]+)"+ \
@@ -399,34 +408,68 @@
 	lineno = 0
 
-	f = open(accessdb_file, "r")
-	for line in f:
-	    lineno += 1
-	    line.strip()
-	    if len(line) == 0 or line.startswith('#'):
-		continue
-	    m = project_line.match(line)
-	    if m:
-		fid = fedid(hexstr=m.group(1))
-		project, user = m.group(2,3)
-		if not access.has_key(fid):
-		    access[fid] = []
-		access[fid].append((project, user))
-		continue
-
-	    m = user_line.match(line)
-	    if m:
-		fid = fedid(hexstr=m.group(1))
-		project = None
-		user = m.group(2)
-		if not access.has_key(fid):
-		    access[fid] = []
-		access[fid].append((project, user))
-		continue
+	# Parse the mappings and store in self.authdb, a dict of 
+	# fedid -> (proj, user)
+	try:
+	    f = open(accessdb_file, "r")
+	    for line in f:
+		lineno += 1
+		line = line.strip()
+		if len(line) == 0 or line.startswith('#'):
+		    continue
+		m = project_line.match(line)
+		if m:
+		    fid = fedid(hexstr=m.group(1))
+		    project, user = m.group(2,3)
+		    if not self.accessdb.has_key(fid):
+			self.accessdb[fid] = []
+		    self.accessdb[fid].append((project, user))
+		    continue
+
+		m = user_line.match(line)
+		if m:
+		    fid = fedid(hexstr=m.group(1))
+		    project = None
+		    user = m.group(2)
+		    if not self.accessdb.has_key(fid):
+			self.accessdb[fid] = []
+		    self.accessdb[fid].append((project, user))
+		    continue
+		self.log.warn("[experiment_control] Error parsing access " +\
+			"db %s at line %d" %  (accessdb_file, lineno))
+	except IOError:
 	    raise service_error(service_error.internal,
-		    "Error parsing access db %s at line %d" % \
-			(accessdb_file, lineno))
+		    "Error opening/reading %s as experiment " +\
+			    "control accessdb" %  accessdb_file)
 	f.close()
-	return access
-
+
+	# Initialize the authorization attributes
+	for fid in self.accessdb.keys():
+	    self.auth.set_attribute(fid, 'create')
+
+    def read_mapdb(self, file):
+	"""
+	Read a simple colon separated list of mappings for the
+	label-to-testbed-URL mappings.  Clears or creates self.tbmap.
+	"""
+
+	self.tbmap = { }
+	lineno =0
+	try:
+	    f = open(file, "r")
+	    for line in f:
+		lineno += 1
+		line = line.strip()
+		if line.startswith('#') or len(line) == 0:
+		    continue
+		try:
+		    label, url = line.split(':', 1)
+		    self.tbmap[label] = url
+		except ValueError, e:
+		    self.log.warn("[read_mapdb] Ignored bad line (%d) in " +\
+			    "map db: %s %s" % (lineno, line, e))
+	except IOError, e:
+	    self.log.warning("[read_mapdb]: No saved map database: Can't " +\
+		    "open %s: %s" % (file, e))
+	f.close()
 
     def scp_file(self, file, user, host, dest=""):
