Index: fedd/federation/experiment_partition.py
===================================================================
--- fedd/federation/experiment_partition.py	(revision f3803eab4eaefa4a2e8fde3103bee76a9f01a3b8)
+++ fedd/federation/experiment_partition.py	(revision 175b444be538c90b2bbb8eded4663576c1f26ad7)
@@ -43,5 +43,6 @@
 
 class experiment_partition: 
-    def __init__(self, auth=None, store_url=None, tbmap=None, muxmax=2):
+    def __init__(self, auth=None, store_url=None, tbmap=None, muxmax=2, 
+	    direct_transit=None):
         """
         Intialize the various attributes
@@ -53,4 +54,5 @@
 	self.store_url = store_url
 	self.tbmap = tbmap
+	self.direct_transit = direct_transit or [ ]
 	self.muxmax = muxmax
 
@@ -90,6 +92,4 @@
 	else:
 	    active = ("%s" % (st > dt))
-
-	print "%s %s" % (st, active)
 
 	ifaces = [ ]
@@ -207,10 +207,11 @@
 	return (tsubstrate, segment_element)
 
-    def new_dragon_topo(self, idx, sub, topo, tbs, tbparams, connInfo, expid):
+    def new_direct_topo(self, idx, sub, topo, tbs, tbparams, connInfo, expid,
+	    tb_name):
 	if sub.capacity is None:
 	    raise service_error(service_error.internal,
 		    "Cannot DRAGON split substrate w/o capacity")
 	segs = [ ]
-	name = join_testbed("dragon", "%d" % idx)
+	name = join_testbed(tb_name, "%d" % idx)
 	substr = topdl.Substrate(name=name, 
 		capacity=sub.capacity.clone(),
@@ -229,10 +230,11 @@
 			],
 		    attribute=[ topdl.Attribute(
-			attribute='dragon_endpoint', 
-			value=tbparams[tb]['dragon']),
+			attribute='%s_endpoint' % tb_name, 
+			value=tbparams[tb][tb_name]),
 			]
 		    )
-	    if tbparams[tb].has_key('vlans'):
-		seg.set_attribute('vlans', tbparams[tb]['vlans'])
+	    vlan_key = "%s_vlans" % tb_name
+	    if vlan_key in tbparams[tb]:
+		seg.set_attribute(vlan_key, tbparams[tb][vlan_key])
 	    segs.append(seg)
 
@@ -243,5 +245,5 @@
 		self.auth.set_attribute(aid, store_key)
 	    except:
-		self.log.debug("[new_dragon_topo] Can't get alloc id for %s?"\
+		self.log.debug("[new_direct_topo] Can't get alloc id for %s?"\
 			% tb)
 
@@ -261,6 +263,5 @@
 			    topdl.Attribute(attribute="transit", value='true'),
 			    topdl.Attribute(attribute="dynamic", value='true'),
-			    topdl.Attribute(attribute="testbed", 
-				value='dragon'),
+			    topdl.Attribute(attribute="testbed", value=tb_name),
 			    topdl.Attribute(attribute="store_keys", 
 				value=store_key),
@@ -268,6 +269,6 @@
 			)
 
-    def create_dragon_substrate(self, sub, topo, tbs, tbparams, masters, eid,
-	    connInfo, expid=None):
+    def create_direct_substrate(self, sub, topo, tbs, tbparams, masters, eid,
+	    connInfo, expid=None, tb_name=None):
 	"""
 	Add attribiutes to the various elements indicating that they are to be
@@ -297,7 +298,7 @@
 	    mproject = 'project'
 
-	# dn is the number of previously created dragon nets.  This routine
-	# creates a net numbered by dn
-	dn = len([x for x in topo.keys() if x.startswith('dragon')])
+	# dn is the number of previously created direct nets on this direct
+	# testbed.  This routine creates a net numbered by dn
+	dn = len([x for x in topo.keys() if x.startswith(tb_name)])
 	# Count the number of interfaces on this substrate in each testbed from
 	# the global topology
@@ -310,5 +311,5 @@
 
 
-	# Set the attributes in the copies that will allow setup of dragon
+	# Set the attributes in the copies that will allow setup of direct
 	# connections.
 	for tb in tbs.keys():
@@ -321,5 +322,5 @@
 		    aid = tbparams[tb]['allocID']['fedid']
 		except:
-		    self.log.debug("[creat_dragon_substrate] " + 
+		    self.log.debug("[create_direct_substrate] " + 
 			    "Can't get alloc id for %s?" %tb)
 		    aid = None
@@ -362,5 +363,6 @@
 			"No substrate %s in testbed %s" % (sub.name, tb))
 
-	self.new_dragon_topo(dn, sub, topo, tbs, tbparams, connInfo, expid)
+	self.new_direct_topo(dn, sub, topo, tbs, tbparams, connInfo, expid,
+		tb_name)
 
     def insert_internet_portals(self, sub, topo, tbs, tbparams, masters, eid,
@@ -420,6 +422,6 @@
 
 		new_portal = False
-		dname = "_".join(split_testbed(dt))
-		sname = "_".join(split_testbed(st))
+		dname = "-".join(split_testbed(dt))
+		sname = "-".join(split_testbed(st))
 		if portals[st].has_key(dt):
 		    # There's a portal set up to go to this destination.
@@ -498,6 +500,6 @@
 	connInfo[st].append(info)
 
-    def new_dragon_portal(self, st, dt, masters, eid, myip, dip, idx, 
-	    substrate, tbparams, expid):
+    def new_direct_portal(self, st, dt, masters, eid, myip, dip, idx, 
+	    substrate, tbparams, expid, tb_name):
 	# Add to the master testbed
 	myname = "%stunnel" % dt
@@ -538,12 +540,23 @@
 	    base_tbs = set([testbed_base(t) for t in tbs])
 
-	    # DRAGON will not create multi-site vlans yet
-	    if len(tbs) == 2 and len(base_tbs) == 2 and \
-		    all([tbparams[x].has_key('dragon') for x in tbs]):
-		self.create_dragon_substrate(s, topo, tbs, tbparams, 
-			masters, eid, connInfo, expid)
+	    # DRAGON will not create multi-site vlans yet, so we don't do multi
+	    # connection direct transits yet.
+	    if len(tbs) == 2 :
+		# NB: the else if on the for loop - if none of the direct
+		# transits is applicable, use the internet.
+		for d in self.direct_transit:
+		    print "Testing %s" % d
+		    if all([tbparams[x].has_key(d) for x in tbs]):
+			self.create_direct_substrate(s, topo, tbs, tbparams, 
+				masters, eid, connInfo, expid, d)
+			break
+		else:
+		    self.insert_internet_portals(s, topo, tbs, tbparams,
+			    masters, eid, segment_substrate, portals,
+			    connInfo, expid)
 	    else:
 		self.insert_internet_portals(s, topo, tbs, tbparams, masters,
 			eid, segment_substrate, portals, connInfo, expid)
+
 
 	# Make sure that all the service importers have a control portal back
@@ -560,83 +573,90 @@
 			e.get_attribute('portal_type') == 'both']) == 0:
 
-		    if tbparams[mtb].has_key('dragon') \
-			    and tbparams[tb].has_key('dragon'):
-
-			idx = len([x for x in topo.keys() \
-				if x.startswith('dragon')])
-			dip, leng = ip_allocator.allocate(4)
-			dip += 1
-			mip = dip+1
-			csub = topdl.Substrate(
-				name="dragon-control-%s" % tb,
-				capacity=topdl.Capacity(100000.0, 'max'),
-				attribute=[
-				    topdl.Attribute(
-					attribute='portal',
-					value='true'
-					)
-				    ]
-				)
-			seg = topdl.Segment(
-				id= tbparams[mtb]['allocID'],
-				type='emulab',
-				uri = self.tbmap.get(testbed_base(mtb), None),
-				interface=[ 
-				    topdl.Interface(
-					substrate=csub.name),
-				    ],
-				attribute = [
-				    topdl.Attribute(attribute=n, value=v)
-					for n, v in (\
-					    ('domain', 
-						tbparams[mtb].get('domain',
-						    ".example.com")),
-					    ('experiment', "%s/%s" % \
-						    (tbparams[mtb].get(
-							'project', 
-							'project'), 
-							eid)),)
-				    ],
-				)
-			portal = self.new_dragon_portal(tb, mtb,
-				masters, eid, dip, mip, idx, csub,
-				tbparams, expid)
-			topo[tb].substrates.append(csub)
-			topo[tb].elements.append(portal)
-			topo[tb].elements.append(seg)
-
-			mcsub = csub.clone()
-			seg = topdl.Segment(
-				id= tbparams[tb]['allocID'],
-				type='emulab',
-				uri = self.tbmap.get(testbed_base(tb), None),
-				interface=[ 
-				    topdl.Interface(
-					substrate=csub.name),
-				    ],
-				attribute = [
-				    topdl.Attribute(attribute=n, value=v)
-					for n, v in (\
-					    ('domain', 
-						tbparams[tb].get('domain',
-						    ".example.com")),
-					    ('experiment', "%s/%s" % \
-						    (tbparams[tb].get('project', 
-							'project'), 
-							eid)),)
-				    ],
-				)
-			portal = self.new_dragon_portal(mtb, tb, masters,
-				eid, mip, dip, idx, mcsub, tbparams, expid)
-			topo[mtb].substrates.append(mcsub)
-			topo[mtb].elements.append(portal)
-			topo[mtb].elements.append(seg)
-			for t in (mtb, tb):
-			    topo[t].incorporate_elements()
-
-			self.create_dragon_substrate(csub, topo, 
-				{tb: ip_addr(mip), mtb: ip_addr(dip)}, 
-				tbparams, masters, eid, connInfo,
-				expid)
+		    for tb_name in self.direct_transit:
+
+			if tbparams[mtb].has_key(tb_name) \
+				and tbparams[tb].has_key(tb_name):
+
+			    idx = len([x for x in topo.keys() \
+				    if x.startswith(tb_name)])
+			    dip, leng = ip_allocator.allocate(4)
+			    dip += 1
+			    mip = dip+1
+			    csub = topdl.Substrate(
+				    name="%s-control-%s" % (tb_name, tb),
+				    capacity=topdl.Capacity(100000.0, 'max'),
+				    attribute=[
+					topdl.Attribute(
+					    attribute='portal',
+					    value='true'
+					    )
+					]
+				    )
+			    seg = topdl.Segment(
+				    id= tbparams[mtb]['allocID'],
+				    type='emulab',
+				    uri = self.tbmap.get(testbed_base(mtb),
+					None),
+				    interface=[ 
+					topdl.Interface(
+					    substrate=csub.name),
+					],
+				    attribute = [
+					topdl.Attribute(attribute=n, value=v)
+					    for n, v in (\
+						('domain', 
+						    tbparams[mtb].get('domain',
+							".example.com")),
+						('experiment', "%s/%s" % \
+							(tbparams[mtb].get(
+							    'project', 
+							    'project'), 
+							    eid)),)
+					],
+				    )
+			    portal = self.new_direct_portal(tb, mtb,
+				    masters, eid, dip, mip, idx, csub,
+				    tbparams, expid, tb_name)
+			    topo[tb].substrates.append(csub)
+			    topo[tb].elements.append(portal)
+			    topo[tb].elements.append(seg)
+
+			    mcsub = csub.clone()
+			    seg = topdl.Segment(
+				    id= tbparams[tb]['allocID'],
+				    type='emulab',
+				    uri = self.tbmap.get(testbed_base(tb),
+					None),
+				    interface=[ 
+					topdl.Interface(
+					    substrate=csub.name),
+					],
+				    attribute = [
+					topdl.Attribute(attribute=n, value=v)
+					    for n, v in (\
+						('domain', 
+						    tbparams[tb].get('domain',
+							".example.com")),
+						('experiment', "%s/%s" % \
+							(tbparams[tb].get('project', 
+							    'project'), 
+							    eid)),)
+					],
+				    )
+			    portal = self.new_direct_portal(mtb, tb, masters,
+				    eid, mip, dip, idx, mcsub, tbparams, expid,
+				    tb_name)
+			    topo[mtb].substrates.append(mcsub)
+			    topo[mtb].elements.append(portal)
+			    topo[mtb].elements.append(seg)
+			    for t in (mtb, tb):
+				topo[t].incorporate_elements()
+
+			    self.create_direct_substrate(csub, topo, 
+				    {tb: ip_addr(mip), mtb: ip_addr(dip)}, 
+				    tbparams, masters, eid, connInfo,
+				    expid, tb_name)
+			    break
+		    # This matches with the for tb_name in self.direct_transit
 		    else:
 			self.add_control_portal(mtb, tb, masters, eid, topo, 
