Changeset a11eda5 for fedd


Ignore:
Timestamp:
Feb 29, 2012 5:06:03 PM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, master
Children:
2bb8b35
Parents:
fe6e0be
Message:

Add support for testbeds to indicate preference for outgoing portal
connections.

Location:
fedd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd_create.py

    rfe6e0be ra11eda5  
    4545                type="string", default=[],
    4646                help="Service description name:exporters:importers:attrs")
     47        self.add_option('--active', action='append', default=[], type='string',
     48                help='a testbed that prefers active protal nodes in the map')
    4749        self.add_option("--map", dest="map", action="append",
    4850                type="string", default=[],
     
    310312
    311313if tbmap:
    312     msg['testbedmap'] = [ { 'testbed': t, 'uri': u } for t, u in tbmap.items() ]
     314    msg['testbedmap'] = [
     315            {
     316                'testbed': t,
     317                'uri': u,
     318                'active': t in opts.active,
     319            } for t, u in tbmap.items()
     320        ]
    313321
    314322if opts.debug > 1: print >>sys.stderr, msg
  • fedd/federation/experiment_control.py

    rfe6e0be ra11eda5  
    385385        Read a simple colon separated list of mappings for the
    386386        label-to-testbed-URL mappings.  Clears or creates self.tbmap.
     387        also adds testbeds to active if they include , active after
     388        their name.
    387389        """
    388390
    389391        self.tbmap = { }
     392        self.tbactive = set()
    390393        lineno =0
    391394        try:
     
    398401                try:
    399402                    label, url = line.split(':', 1)
     403                    if ',' in label:
     404                        label, act = label.split(',', 1)
     405                        active = (act.strip() == 'active')
     406                    else:
     407                        active = False
    400408                    self.tbmap[label] = url
     409                    if active: self.tbactive.add(label)
    401410                except ValueError, e:
    402411                    self.log.warn("[read_mapdb] Ignored bad line (%d) in " +\
     
    21322141        # of the testbed map.
    21332142        tbmap = dict(self.tbmap)
     2143        tbactive = set(self.tbactive)
    21342144        for m in req.get('testbedmap', []):
    21352145            if 'testbed' in m and 'uri' in m:
    21362146                tbmap[m['testbed']] = m['uri']
     2147                if 'active' in m and m['active']: tbactive.add(m['testbed'])
    21372148
    21382149        # a place to work
     
    21822193
    21832194            part = experiment_partition(self.auth, self.store_url, tbmap,
    2184                     self.muxmax, self.direct_transit)
     2195                    self.muxmax, self.direct_transit, tbactive)
    21852196            part.add_portals(top, topo, eid, pmasters, tbparams, ip_allocator,
    21862197                    connInfo, expid)
  • fedd/federation/experiment_partition.py

    rfe6e0be ra11eda5  
    4444class experiment_partition:
    4545    def __init__(self, auth=None, store_url=None, tbmap=None, muxmax=2,
    46             direct_transit=None):
     46            direct_transit=None, tbactive=None):
    4747        """
    4848        Intialize the various attributes
     
    5656        self.direct_transit = direct_transit or [ ]
    5757        self.muxmax = muxmax
     58        self.tbactive = tbactive
    5859
    5960
     
    8990        ddomain = tbparams[dt].get_attribute('domain', '.example.com')
    9091
    91         if (st in masters and dt not in masters) or \
     92        if (st in self.tbactive and dt not in self.tbactive) or \
     93                ( st not in self.tbactive and dt in self.tbactive ):
     94            active = ("%s" % (st in self.tbactive))
     95        elif (st in masters and dt not in masters) or \
    9296                ( st not in masters and dt in masters ):
    9397            active = ("%s" % (st in masters))
Note: See TracChangeset for help on using the changeset viewer.