Changeset 0c4b12c


Ignore:
Timestamp:
Apr 14, 2010 2:17:59 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
43197eb
Parents:
c23684d
Message:

more de mastering

Location:
fedd/federation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    rc23684d r0c4b12c  
    892892                    # The else connects with the for
    893893                    for a in s['fedAttr']:
    894                         if a.get('attribute', None) == 'testbed'):
     894                        if a.get('attribute', None) == 'testbed':
    895895                            break
    896896                    else:
     
    16451645                            tb = a.get('value', None)
    16461646                            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','')])
    16491651                            else:
    16501652                                log.error('Testbed attribute with no value?')
  • fedd/federation/experiment_partition.py

    rc23684d r0c4b12c  
    8181
    8282        dproject = tbparams[dt].get('project', 'project')
    83         ddomain = tbparams[dt].get('domain', ".example.com")
     83        ddomain = tbparams[dt].get('domain', '.example.com')
    8484
    8585        if (st in masters and dt not in masters) or \
     
    167167                            ('portal', 'true'),
    168168                            ('portal_type', portal_type),
     169                            ('destination_testbed', dt),
    169170                        )
    170171                    ],
     
    463464                    connInfo[st].append(info)
    464465
    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):
    466468        # Add to the master testbed
    467469        tsubstrate, segment_element = \
     
    531533        # Make sure that all the service importers have a control portal back
    532534        # 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)
    623627
    624628        # Connect the portal nodes into the topologies and clear out
    625629        # substrates that are not in the topologies
    626         for tb in tbparams.keys():
     630        for tb in tbparams:
    627631            topo[tb].incorporate_elements()
    628632            topo[tb].substrates = \
Note: See TracChangeset for help on using the changeset viewer.