Index: fedd/federation/experiment_control.py
===================================================================
--- fedd/federation/experiment_control.py	(revision c23684d2478ee3e7f07480cb12b95039a4335c40)
+++ fedd/federation/experiment_control.py	(revision 0c4b12c9dc95469be51940af31ee97a0bc6ade59)
@@ -892,5 +892,5 @@
 		    # The else connects with the for
 		    for a in s['fedAttr']:
-			if a.get('attribute', None) == 'testbed'):
+			if a.get('attribute', None) == 'testbed':
 			    break
 		    else:
@@ -1645,6 +1645,8 @@
 			    tb = a.get('value', None)
 			    if tb:
-				if masters.has_key(tb): masters[tb].add(s.name)
-				else: masters[tb] = set([s.name])
+				if masters.has_key(tb): 
+				    masters[tb].add(s.get('name',''))
+				else:
+				    masters[tb] = set([s.get('name','')])
 			    else:
 				log.error('Testbed attribute with no value?')
Index: fedd/federation/experiment_partition.py
===================================================================
--- fedd/federation/experiment_partition.py	(revision c23684d2478ee3e7f07480cb12b95039a4335c40)
+++ fedd/federation/experiment_partition.py	(revision 0c4b12c9dc95469be51940af31ee97a0bc6ade59)
@@ -81,5 +81,5 @@
 
 	dproject = tbparams[dt].get('project', 'project')
-	ddomain = tbparams[dt].get('domain', ".example.com")
+	ddomain = tbparams[dt].get('domain', '.example.com')
 
 	if (st in masters and dt not in masters) or \
@@ -167,4 +167,5 @@
 			    ('portal', 'true'),
 			    ('portal_type', portal_type), 
+			    ('destination_testbed', dt),
 			)
 		    ],
@@ -463,5 +464,6 @@
 		    connInfo[st].append(info)
 
-    def add_control_portal(self, st, dt, masters, eid, topo, tbparams, connInfo, expid):
+    def add_control_portal(self, st, dt, masters, eid, topo, tbparams, 
+	    connInfo, expid):
 	# Add to the master testbed
 	tsubstrate, segment_element = \
@@ -531,98 +533,100 @@
 	# Make sure that all the service importers have a control portal back
 	# to the master for each service.
-	#XXX you're here
-	for tb in [ t for t in tbparams.keys() if t != master ]:
-	    if len([e for e in topo[tb].elements \
-		    if isinstance(e, topdl.Computer) and \
-		    e.get_attribute('portal') and \
-		    e.get_attribute('portal_type') == 'both']) == 0:
-
-		if tbparams[master].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[master]['allocID'],
-			    type='emulab',
-			    uri = self.tbmap.get(master, None),
-			    interface=[ 
-				topdl.Interface(
-				    substrate=csub.name),
-				],
-			    attribute = [
-				topdl.Attribute(attribute=n, value=v)
-				    for n, v in (\
-					('domain', 
-					    tbparams[master].get('domain',
-						".example.com")),
-					('experiment', "%s/%s" % \
-						(tbparams[master].get(
-						    'project', 
-						    'project'), 
-						    eid)),)
-				],
-			    )
-		    portal = self.new_dragon_portal(tb, master,
-			    master, 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(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(master, tb, master,
-			    eid, mip, dip, idx, mcsub, tbparams, expid)
-		    topo[master].substrates.append(mcsub)
-		    topo[master].elements.append(portal)
-		    topo[master].elements.append(seg)
-		    for t in (master, tb):
-			topo[t].incorporate_elements()
-
-		    self.create_dragon_substrate(csub, topo, 
-			    {tb: ip_addr(mip), master: ip_addr(dip)}, 
-			    tbparams, master, eid, connInfo,
-			    expid)
-		else:
-		    self.add_control_portal(master, tb, master, eid, topo, 
-			    tbparams, connInfo, expid)
-		    self.add_control_portal(tb, master, master, eid, topo, 
-			    tbparams, connInfo, expid)
+	for mtb in [ t for t in tbparams if t in masters ]:
+	    for tb in [ t for tb in tbparams if t != mtb]:
+		if len([e for e in topo[tb].elements \
+			if isinstance(e, topdl.Computer) and \
+			e.get_attribute('destination_testbed') == mtb and \
+			e.get_attribute('portal') and \
+			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(master, 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(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 (master, tb):
+			    topo[t].incorporate_elements()
+
+			self.create_dragon_substrate(csub, topo, 
+				{tb: ip_addr(mip), mtb: ip_addr(dip)}, 
+				tbparams, masters, eid, connInfo,
+				expid)
+		    else:
+			self.add_control_portal(mtb, tb, masters, eid, topo, 
+				tbparams, connInfo, expid)
+			self.add_control_portal(tb, mtb, masters, eid, topo, 
+				tbparams, connInfo, expid)
 
 	# Connect the portal nodes into the topologies and clear out
 	# substrates that are not in the topologies
-	for tb in tbparams.keys():
+	for tb in tbparams:
 	    topo[tb].incorporate_elements()
 	    topo[tb].substrates = \
