Changeset 0c4b12c
- Timestamp:
- Apr 14, 2010 2:17:59 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 43197eb
- Parents:
- c23684d
- Location:
- fedd/federation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/experiment_control.py
rc23684d r0c4b12c 892 892 # The else connects with the for 893 893 for a in s['fedAttr']: 894 if a.get('attribute', None) == 'testbed' ):894 if a.get('attribute', None) == 'testbed': 895 895 break 896 896 else: … … 1645 1645 tb = a.get('value', None) 1646 1646 if tb: 1647 if masters.has_key(tb): masters[tb].add(s.name) 1648 else: masters[tb] = set([s.name]) 1647 if masters.has_key(tb): 1648 masters[tb].add(s.get('name','')) 1649 else: 1650 masters[tb] = set([s.get('name','')]) 1649 1651 else: 1650 1652 log.error('Testbed attribute with no value?') -
fedd/federation/experiment_partition.py
rc23684d r0c4b12c 81 81 82 82 dproject = tbparams[dt].get('project', 'project') 83 ddomain = tbparams[dt].get('domain', ".example.com")83 ddomain = tbparams[dt].get('domain', '.example.com') 84 84 85 85 if (st in masters and dt not in masters) or \ … … 167 167 ('portal', 'true'), 168 168 ('portal_type', portal_type), 169 ('destination_testbed', dt), 169 170 ) 170 171 ], … … 463 464 connInfo[st].append(info) 464 465 465 def add_control_portal(self, st, dt, masters, eid, topo, tbparams, connInfo, expid): 466 def add_control_portal(self, st, dt, masters, eid, topo, tbparams, 467 connInfo, expid): 466 468 # Add to the master testbed 467 469 tsubstrate, segment_element = \ … … 531 533 # Make sure that all the service importers have a control portal back 532 534 # to the master for each service. 533 #XXX you're here 534 for tb in [ t for t in tbparams.keys() if t != master ]: 535 if len([e for e in topo[tb].elements \ 536 if isinstance(e, topdl.Computer) and \ 537 e.get_attribute('portal') and \ 538 e.get_attribute('portal_type') == 'both']) == 0: 539 540 if tbparams[master].has_key('dragon') \ 541 and tbparams[tb].has_key('dragon'): 542 543 idx = len([x for x in topo.keys() \ 544 if x.startswith('dragon')]) 545 dip, leng = ip_allocator.allocate(4) 546 dip += 1 547 mip = dip+1 548 csub = topdl.Substrate( 549 name="dragon-control-%s" % tb, 550 capacity=topdl.Capacity(100000.0, 'max'), 551 attribute=[ 552 topdl.Attribute( 553 attribute='portal', 554 value='true' 555 ) 556 ] 557 ) 558 seg = topdl.Segment( 559 id= tbparams[master]['allocID'], 560 type='emulab', 561 uri = self.tbmap.get(master, None), 562 interface=[ 563 topdl.Interface( 564 substrate=csub.name), 565 ], 566 attribute = [ 567 topdl.Attribute(attribute=n, value=v) 568 for n, v in (\ 569 ('domain', 570 tbparams[master].get('domain', 571 ".example.com")), 572 ('experiment', "%s/%s" % \ 573 (tbparams[master].get( 574 'project', 575 'project'), 576 eid)),) 577 ], 578 ) 579 portal = self.new_dragon_portal(tb, master, 580 master, eid, dip, mip, idx, csub, tbparams, expid) 581 topo[tb].substrates.append(csub) 582 topo[tb].elements.append(portal) 583 topo[tb].elements.append(seg) 584 585 mcsub = csub.clone() 586 seg = topdl.Segment( 587 id= tbparams[tb]['allocID'], 588 type='emulab', 589 uri = self.tbmap.get(tb, None), 590 interface=[ 591 topdl.Interface( 592 substrate=csub.name), 593 ], 594 attribute = [ 595 topdl.Attribute(attribute=n, value=v) 596 for n, v in (\ 597 ('domain', 598 tbparams[tb].get('domain', 599 ".example.com")), 600 ('experiment', "%s/%s" % \ 601 (tbparams[tb].get('project', 602 'project'), 603 eid)),) 604 ], 605 ) 606 portal = self.new_dragon_portal(master, tb, master, 607 eid, mip, dip, idx, mcsub, tbparams, expid) 608 topo[master].substrates.append(mcsub) 609 topo[master].elements.append(portal) 610 topo[master].elements.append(seg) 611 for t in (master, tb): 612 topo[t].incorporate_elements() 613 614 self.create_dragon_substrate(csub, topo, 615 {tb: ip_addr(mip), master: ip_addr(dip)}, 616 tbparams, master, eid, connInfo, 617 expid) 618 else: 619 self.add_control_portal(master, tb, master, eid, topo, 620 tbparams, connInfo, expid) 621 self.add_control_portal(tb, master, master, eid, topo, 622 tbparams, connInfo, expid) 535 for mtb in [ t for t in tbparams if t in masters ]: 536 for tb in [ t for tb in tbparams if t != mtb]: 537 if len([e for e in topo[tb].elements \ 538 if isinstance(e, topdl.Computer) and \ 539 e.get_attribute('destination_testbed') == mtb and \ 540 e.get_attribute('portal') and \ 541 e.get_attribute('portal_type') == 'both']) == 0: 542 543 if tbparams[mtb].has_key('dragon') \ 544 and tbparams[tb].has_key('dragon'): 545 546 idx = len([x for x in topo.keys() \ 547 if x.startswith('dragon')]) 548 dip, leng = ip_allocator.allocate(4) 549 dip += 1 550 mip = dip+1 551 csub = topdl.Substrate( 552 name="dragon-control-%s" % tb, 553 capacity=topdl.Capacity(100000.0, 'max'), 554 attribute=[ 555 topdl.Attribute( 556 attribute='portal', 557 value='true' 558 ) 559 ] 560 ) 561 seg = topdl.Segment( 562 id= tbparams[mtb]['allocID'], 563 type='emulab', 564 uri = self.tbmap.get(master, None), 565 interface=[ 566 topdl.Interface( 567 substrate=csub.name), 568 ], 569 attribute = [ 570 topdl.Attribute(attribute=n, value=v) 571 for n, v in (\ 572 ('domain', 573 tbparams[mtb].get('domain', 574 ".example.com")), 575 ('experiment', "%s/%s" % \ 576 (tbparams[mtb].get( 577 'project', 578 'project'), 579 eid)),) 580 ], 581 ) 582 portal = self.new_dragon_portal(tb, mtb, 583 masters, eid, dip, mip, idx, csub, 584 tbparams, expid) 585 topo[tb].substrates.append(csub) 586 topo[tb].elements.append(portal) 587 topo[tb].elements.append(seg) 588 589 mcsub = csub.clone() 590 seg = topdl.Segment( 591 id= tbparams[tb]['allocID'], 592 type='emulab', 593 uri = self.tbmap.get(tb, None), 594 interface=[ 595 topdl.Interface( 596 substrate=csub.name), 597 ], 598 attribute = [ 599 topdl.Attribute(attribute=n, value=v) 600 for n, v in (\ 601 ('domain', 602 tbparams[tb].get('domain', 603 ".example.com")), 604 ('experiment', "%s/%s" % \ 605 (tbparams[tb].get('project', 606 'project'), 607 eid)),) 608 ], 609 ) 610 portal = self.new_dragon_portal(mtb, tb, masters, 611 eid, mip, dip, idx, mcsub, tbparams, expid) 612 topo[mtb].substrates.append(mcsub) 613 topo[mtb].elements.append(portal) 614 topo[mtb].elements.append(seg) 615 for t in (master, tb): 616 topo[t].incorporate_elements() 617 618 self.create_dragon_substrate(csub, topo, 619 {tb: ip_addr(mip), mtb: ip_addr(dip)}, 620 tbparams, masters, eid, connInfo, 621 expid) 622 else: 623 self.add_control_portal(mtb, tb, masters, eid, topo, 624 tbparams, connInfo, expid) 625 self.add_control_portal(tb, mtb, masters, eid, topo, 626 tbparams, connInfo, expid) 623 627 624 628 # Connect the portal nodes into the topologies and clear out 625 629 # substrates that are not in the topologies 626 for tb in tbparams .keys():630 for tb in tbparams: 627 631 topo[tb].incorporate_elements() 628 632 topo[tb].substrates = \
Note: See TracChangeset
for help on using the changeset viewer.