Changeset 175b444


Ignore:
Timestamp:
May 10, 2010 2:20:40 PM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
10a7053
Parents:
e77c86e
Message:

Add a new plugin for the DETER internal network, and generalize the dragon partition code to accept different networks.

Location:
fedd/federation
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/deter_impl.py

    re77c86e r175b444  
    44import dragon_access
    55import protogeni_access
     6import deter_internal_access
     7
    68from experiment_control import experiment_control_local
    79from ns2topdl import ns2topdl_local
     
    7577                elif self.access_type == "protogeni":
    7678                    self.access = protogeni_access.access(config, self.auth)
     79                elif self.access_type == "deter_internal":
     80                    self.access = deter_internal_access.access(config,
     81                            self.auth)
    7782                else:
    7883                    raise RuntimeError("Unknown access_type: %s" % \
  • fedd/federation/experiment_control.py

    re77c86e r175b444  
    270270        self.ssh_privkey_file = config.get("experiment_control",
    271271                "ssh_privkey_file")
     272        dt = config.get("experiment_control", "direct_transit")
     273        self.direct_transit = [ tb.strip() for tb in dt.split(",")]
    272274        # NB for internal master/slave ops, not experiment setup
    273275        self.ssh_type = config.get("experiment_control", "sshkeytype", "rsa")
     
    11321134            if suffix:
    11331135                tb_attrs.append({'attribute': 'experiment_name',
    1134                     'value': "%s_%s" % (eid, suffix)})
     1136                    'value': "%s-%s" % (eid, suffix)})
    11351137            else:
    11361138                tb_attrs.append({'attribute': 'experiment_name', 'value': eid})
     
    17641766
    17651767            part = experiment_partition(self.auth, self.store_url, self.tbmap,
    1766                     self.muxmax)
     1768                    self.muxmax, self.direct_transit)
    17671769            part.add_portals(top, topo, eid, masters, tbparams, ip_allocator,
    17681770                    connInfo, expid)
  • fedd/federation/experiment_partition.py

    re77c86e r175b444  
    4343
    4444class experiment_partition:
    45     def __init__(self, auth=None, store_url=None, tbmap=None, muxmax=2):
     45    def __init__(self, auth=None, store_url=None, tbmap=None, muxmax=2,
     46            direct_transit=None):
    4647        """
    4748        Intialize the various attributes
     
    5354        self.store_url = store_url
    5455        self.tbmap = tbmap
     56        self.direct_transit = direct_transit or [ ]
    5557        self.muxmax = muxmax
    5658
     
    9092        else:
    9193            active = ("%s" % (st > dt))
    92 
    93         print "%s %s" % (st, active)
    9494
    9595        ifaces = [ ]
     
    207207        return (tsubstrate, segment_element)
    208208
    209     def new_dragon_topo(self, idx, sub, topo, tbs, tbparams, connInfo, expid):
     209    def new_direct_topo(self, idx, sub, topo, tbs, tbparams, connInfo, expid,
     210            tb_name):
    210211        if sub.capacity is None:
    211212            raise service_error(service_error.internal,
    212213                    "Cannot DRAGON split substrate w/o capacity")
    213214        segs = [ ]
    214         name = join_testbed("dragon", "%d" % idx)
     215        name = join_testbed(tb_name, "%d" % idx)
    215216        substr = topdl.Substrate(name=name,
    216217                capacity=sub.capacity.clone(),
     
    229230                        ],
    230231                    attribute=[ topdl.Attribute(
    231                         attribute='dragon_endpoint',
    232                         value=tbparams[tb]['dragon']),
     232                        attribute='%s_endpoint' % tb_name,
     233                        value=tbparams[tb][tb_name]),
    233234                        ]
    234235                    )
    235             if tbparams[tb].has_key('vlans'):
    236                 seg.set_attribute('vlans', tbparams[tb]['vlans'])
     236            vlan_key = "%s_vlans" % tb_name
     237            if vlan_key in tbparams[tb]:
     238                seg.set_attribute(vlan_key, tbparams[tb][vlan_key])
    237239            segs.append(seg)
    238240
     
    243245                self.auth.set_attribute(aid, store_key)
    244246            except:
    245                 self.log.debug("[new_dragon_topo] Can't get alloc id for %s?"\
     247                self.log.debug("[new_direct_topo] Can't get alloc id for %s?"\
    246248                        % tb)
    247249
     
    261263                            topdl.Attribute(attribute="transit", value='true'),
    262264                            topdl.Attribute(attribute="dynamic", value='true'),
    263                             topdl.Attribute(attribute="testbed",
    264                                 value='dragon'),
     265                            topdl.Attribute(attribute="testbed", value=tb_name),
    265266                            topdl.Attribute(attribute="store_keys",
    266267                                value=store_key),
     
    268269                        )
    269270
    270     def create_dragon_substrate(self, sub, topo, tbs, tbparams, masters, eid,
    271             connInfo, expid=None):
     271    def create_direct_substrate(self, sub, topo, tbs, tbparams, masters, eid,
     272            connInfo, expid=None, tb_name=None):
    272273        """
    273274        Add attribiutes to the various elements indicating that they are to be
     
    297298            mproject = 'project'
    298299
    299         # dn is the number of previously created dragon nets.  This routine
    300         # creates a net numbered by dn
    301         dn = len([x for x in topo.keys() if x.startswith('dragon')])
     300        # dn is the number of previously created direct nets on this direct
     301        # testbed.  This routine creates a net numbered by dn
     302        dn = len([x for x in topo.keys() if x.startswith(tb_name)])
    302303        # Count the number of interfaces on this substrate in each testbed from
    303304        # the global topology
     
    310311
    311312
    312         # Set the attributes in the copies that will allow setup of dragon
     313        # Set the attributes in the copies that will allow setup of direct
    313314        # connections.
    314315        for tb in tbs.keys():
     
    321322                    aid = tbparams[tb]['allocID']['fedid']
    322323                except:
    323                     self.log.debug("[creat_dragon_substrate] " +
     324                    self.log.debug("[create_direct_substrate] " +
    324325                            "Can't get alloc id for %s?" %tb)
    325326                    aid = None
     
    362363                        "No substrate %s in testbed %s" % (sub.name, tb))
    363364
    364         self.new_dragon_topo(dn, sub, topo, tbs, tbparams, connInfo, expid)
     365        self.new_direct_topo(dn, sub, topo, tbs, tbparams, connInfo, expid,
     366                tb_name)
    365367
    366368    def insert_internet_portals(self, sub, topo, tbs, tbparams, masters, eid,
     
    420422
    421423                new_portal = False
    422                 dname = "_".join(split_testbed(dt))
    423                 sname = "_".join(split_testbed(st))
     424                dname = "-".join(split_testbed(dt))
     425                sname = "-".join(split_testbed(st))
    424426                if portals[st].has_key(dt):
    425427                    # There's a portal set up to go to this destination.
     
    498500        connInfo[st].append(info)
    499501
    500     def new_dragon_portal(self, st, dt, masters, eid, myip, dip, idx,
    501             substrate, tbparams, expid):
     502    def new_direct_portal(self, st, dt, masters, eid, myip, dip, idx,
     503            substrate, tbparams, expid, tb_name):
    502504        # Add to the master testbed
    503505        myname = "%stunnel" % dt
     
    538540            base_tbs = set([testbed_base(t) for t in tbs])
    539541
    540             # DRAGON will not create multi-site vlans yet
    541             if len(tbs) == 2 and len(base_tbs) == 2 and \
    542                     all([tbparams[x].has_key('dragon') for x in tbs]):
    543                 self.create_dragon_substrate(s, topo, tbs, tbparams,
    544                         masters, eid, connInfo, expid)
     542            # DRAGON will not create multi-site vlans yet, so we don't do multi
     543            # connection direct transits yet.
     544            if len(tbs) == 2 :
     545                # NB: the else if on the for loop - if none of the direct
     546                # transits is applicable, use the internet.
     547                for d in self.direct_transit:
     548                    print "Testing %s" % d
     549                    if all([tbparams[x].has_key(d) for x in tbs]):
     550                        self.create_direct_substrate(s, topo, tbs, tbparams,
     551                                masters, eid, connInfo, expid, d)
     552                        break
     553                else:
     554                    self.insert_internet_portals(s, topo, tbs, tbparams,
     555                            masters, eid, segment_substrate, portals,
     556                            connInfo, expid)
    545557            else:
    546558                self.insert_internet_portals(s, topo, tbs, tbparams, masters,
    547559                        eid, segment_substrate, portals, connInfo, expid)
     560
    548561
    549562        # Make sure that all the service importers have a control portal back
     
    560573                        e.get_attribute('portal_type') == 'both']) == 0:
    561574
    562                     if tbparams[mtb].has_key('dragon') \
    563                             and tbparams[tb].has_key('dragon'):
    564 
    565                         idx = len([x for x in topo.keys() \
    566                                 if x.startswith('dragon')])
    567                         dip, leng = ip_allocator.allocate(4)
    568                         dip += 1
    569                         mip = dip+1
    570                         csub = topdl.Substrate(
    571                                 name="dragon-control-%s" % tb,
    572                                 capacity=topdl.Capacity(100000.0, 'max'),
    573                                 attribute=[
    574                                     topdl.Attribute(
    575                                         attribute='portal',
    576                                         value='true'
    577                                         )
    578                                     ]
    579                                 )
    580                         seg = topdl.Segment(
    581                                 id= tbparams[mtb]['allocID'],
    582                                 type='emulab',
    583                                 uri = self.tbmap.get(testbed_base(mtb), None),
    584                                 interface=[
    585                                     topdl.Interface(
    586                                         substrate=csub.name),
    587                                     ],
    588                                 attribute = [
    589                                     topdl.Attribute(attribute=n, value=v)
    590                                         for n, v in (\
    591                                             ('domain',
    592                                                 tbparams[mtb].get('domain',
    593                                                     ".example.com")),
    594                                             ('experiment', "%s/%s" % \
    595                                                     (tbparams[mtb].get(
    596                                                         'project',
    597                                                         'project'),
    598                                                         eid)),)
    599                                     ],
    600                                 )
    601                         portal = self.new_dragon_portal(tb, mtb,
    602                                 masters, eid, dip, mip, idx, csub,
    603                                 tbparams, expid)
    604                         topo[tb].substrates.append(csub)
    605                         topo[tb].elements.append(portal)
    606                         topo[tb].elements.append(seg)
    607 
    608                         mcsub = csub.clone()
    609                         seg = topdl.Segment(
    610                                 id= tbparams[tb]['allocID'],
    611                                 type='emulab',
    612                                 uri = self.tbmap.get(testbed_base(tb), None),
    613                                 interface=[
    614                                     topdl.Interface(
    615                                         substrate=csub.name),
    616                                     ],
    617                                 attribute = [
    618                                     topdl.Attribute(attribute=n, value=v)
    619                                         for n, v in (\
    620                                             ('domain',
    621                                                 tbparams[tb].get('domain',
    622                                                     ".example.com")),
    623                                             ('experiment', "%s/%s" % \
    624                                                     (tbparams[tb].get('project',
    625                                                         'project'),
    626                                                         eid)),)
    627                                     ],
    628                                 )
    629                         portal = self.new_dragon_portal(mtb, tb, masters,
    630                                 eid, mip, dip, idx, mcsub, tbparams, expid)
    631                         topo[mtb].substrates.append(mcsub)
    632                         topo[mtb].elements.append(portal)
    633                         topo[mtb].elements.append(seg)
    634                         for t in (mtb, tb):
    635                             topo[t].incorporate_elements()
    636 
    637                         self.create_dragon_substrate(csub, topo,
    638                                 {tb: ip_addr(mip), mtb: ip_addr(dip)},
    639                                 tbparams, masters, eid, connInfo,
    640                                 expid)
     575                    for tb_name in self.direct_transit:
     576
     577                        if tbparams[mtb].has_key(tb_name) \
     578                                and tbparams[tb].has_key(tb_name):
     579
     580                            idx = len([x for x in topo.keys() \
     581                                    if x.startswith(tb_name)])
     582                            dip, leng = ip_allocator.allocate(4)
     583                            dip += 1
     584                            mip = dip+1
     585                            csub = topdl.Substrate(
     586                                    name="%s-control-%s" % (tb_name, tb),
     587                                    capacity=topdl.Capacity(100000.0, 'max'),
     588                                    attribute=[
     589                                        topdl.Attribute(
     590                                            attribute='portal',
     591                                            value='true'
     592                                            )
     593                                        ]
     594                                    )
     595                            seg = topdl.Segment(
     596                                    id= tbparams[mtb]['allocID'],
     597                                    type='emulab',
     598                                    uri = self.tbmap.get(testbed_base(mtb),
     599                                        None),
     600                                    interface=[
     601                                        topdl.Interface(
     602                                            substrate=csub.name),
     603                                        ],
     604                                    attribute = [
     605                                        topdl.Attribute(attribute=n, value=v)
     606                                            for n, v in (\
     607                                                ('domain',
     608                                                    tbparams[mtb].get('domain',
     609                                                        ".example.com")),
     610                                                ('experiment', "%s/%s" % \
     611                                                        (tbparams[mtb].get(
     612                                                            'project',
     613                                                            'project'),
     614                                                            eid)),)
     615                                        ],
     616                                    )
     617                            portal = self.new_direct_portal(tb, mtb,
     618                                    masters, eid, dip, mip, idx, csub,
     619                                    tbparams, expid, tb_name)
     620                            topo[tb].substrates.append(csub)
     621                            topo[tb].elements.append(portal)
     622                            topo[tb].elements.append(seg)
     623
     624                            mcsub = csub.clone()
     625                            seg = topdl.Segment(
     626                                    id= tbparams[tb]['allocID'],
     627                                    type='emulab',
     628                                    uri = self.tbmap.get(testbed_base(tb),
     629                                        None),
     630                                    interface=[
     631                                        topdl.Interface(
     632                                            substrate=csub.name),
     633                                        ],
     634                                    attribute = [
     635                                        topdl.Attribute(attribute=n, value=v)
     636                                            for n, v in (\
     637                                                ('domain',
     638                                                    tbparams[tb].get('domain',
     639                                                        ".example.com")),
     640                                                ('experiment', "%s/%s" % \
     641                                                        (tbparams[tb].get('project',
     642                                                            'project'),
     643                                                            eid)),)
     644                                        ],
     645                                    )
     646                            portal = self.new_direct_portal(mtb, tb, masters,
     647                                    eid, mip, dip, idx, mcsub, tbparams, expid,
     648                                    tb_name)
     649                            topo[mtb].substrates.append(mcsub)
     650                            topo[mtb].elements.append(portal)
     651                            topo[mtb].elements.append(seg)
     652                            for t in (mtb, tb):
     653                                topo[t].incorporate_elements()
     654
     655                            self.create_direct_substrate(csub, topo,
     656                                    {tb: ip_addr(mip), mtb: ip_addr(dip)},
     657                                    tbparams, masters, eid, connInfo,
     658                                    expid, tb_name)
     659                            break
     660                    # This matches with the for tb_name in self.direct_transit
    641661                    else:
    642662                        self.add_control_portal(mtb, tb, masters, eid, topo,
Note: See TracChangeset for help on using the changeset viewer.