- Timestamp:
- May 10, 2010 2:20:40 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 10a7053
- Parents:
- e77c86e
- Location:
- fedd/federation
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/deter_impl.py
re77c86e r175b444 4 4 import dragon_access 5 5 import protogeni_access 6 import deter_internal_access 7 6 8 from experiment_control import experiment_control_local 7 9 from ns2topdl import ns2topdl_local … … 75 77 elif self.access_type == "protogeni": 76 78 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) 77 82 else: 78 83 raise RuntimeError("Unknown access_type: %s" % \ -
fedd/federation/experiment_control.py
re77c86e r175b444 270 270 self.ssh_privkey_file = config.get("experiment_control", 271 271 "ssh_privkey_file") 272 dt = config.get("experiment_control", "direct_transit") 273 self.direct_transit = [ tb.strip() for tb in dt.split(",")] 272 274 # NB for internal master/slave ops, not experiment setup 273 275 self.ssh_type = config.get("experiment_control", "sshkeytype", "rsa") … … 1132 1134 if suffix: 1133 1135 tb_attrs.append({'attribute': 'experiment_name', 1134 'value': "%s _%s" % (eid, suffix)})1136 'value': "%s-%s" % (eid, suffix)}) 1135 1137 else: 1136 1138 tb_attrs.append({'attribute': 'experiment_name', 'value': eid}) … … 1764 1766 1765 1767 part = experiment_partition(self.auth, self.store_url, self.tbmap, 1766 self.muxmax )1768 self.muxmax, self.direct_transit) 1767 1769 part.add_portals(top, topo, eid, masters, tbparams, ip_allocator, 1768 1770 connInfo, expid) -
fedd/federation/experiment_partition.py
re77c86e r175b444 43 43 44 44 class 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): 46 47 """ 47 48 Intialize the various attributes … … 53 54 self.store_url = store_url 54 55 self.tbmap = tbmap 56 self.direct_transit = direct_transit or [ ] 55 57 self.muxmax = muxmax 56 58 … … 90 92 else: 91 93 active = ("%s" % (st > dt)) 92 93 print "%s %s" % (st, active)94 94 95 95 ifaces = [ ] … … 207 207 return (tsubstrate, segment_element) 208 208 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): 210 211 if sub.capacity is None: 211 212 raise service_error(service_error.internal, 212 213 "Cannot DRAGON split substrate w/o capacity") 213 214 segs = [ ] 214 name = join_testbed( "dragon", "%d" % idx)215 name = join_testbed(tb_name, "%d" % idx) 215 216 substr = topdl.Substrate(name=name, 216 217 capacity=sub.capacity.clone(), … … 229 230 ], 230 231 attribute=[ topdl.Attribute( 231 attribute=' dragon_endpoint',232 value=tbparams[tb][ 'dragon']),232 attribute='%s_endpoint' % tb_name, 233 value=tbparams[tb][tb_name]), 233 234 ] 234 235 ) 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]) 237 239 segs.append(seg) 238 240 … … 243 245 self.auth.set_attribute(aid, store_key) 244 246 except: 245 self.log.debug("[new_d ragon_topo] Can't get alloc id for %s?"\247 self.log.debug("[new_direct_topo] Can't get alloc id for %s?"\ 246 248 % tb) 247 249 … … 261 263 topdl.Attribute(attribute="transit", value='true'), 262 264 topdl.Attribute(attribute="dynamic", value='true'), 263 topdl.Attribute(attribute="testbed", 264 value='dragon'), 265 topdl.Attribute(attribute="testbed", value=tb_name), 265 266 topdl.Attribute(attribute="store_keys", 266 267 value=store_key), … … 268 269 ) 269 270 270 def create_d ragon_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): 272 273 """ 273 274 Add attribiutes to the various elements indicating that they are to be … … 297 298 mproject = 'project' 298 299 299 # dn is the number of previously created d ragon nets. This routine300 # creates a net numbered by dn301 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)]) 302 303 # Count the number of interfaces on this substrate in each testbed from 303 304 # the global topology … … 310 311 311 312 312 # Set the attributes in the copies that will allow setup of d ragon313 # Set the attributes in the copies that will allow setup of direct 313 314 # connections. 314 315 for tb in tbs.keys(): … … 321 322 aid = tbparams[tb]['allocID']['fedid'] 322 323 except: 323 self.log.debug("[creat _dragon_substrate] " +324 self.log.debug("[create_direct_substrate] " + 324 325 "Can't get alloc id for %s?" %tb) 325 326 aid = None … … 362 363 "No substrate %s in testbed %s" % (sub.name, tb)) 363 364 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) 365 367 366 368 def insert_internet_portals(self, sub, topo, tbs, tbparams, masters, eid, … … 420 422 421 423 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)) 424 426 if portals[st].has_key(dt): 425 427 # There's a portal set up to go to this destination. … … 498 500 connInfo[st].append(info) 499 501 500 def new_d ragon_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): 502 504 # Add to the master testbed 503 505 myname = "%stunnel" % dt … … 538 540 base_tbs = set([testbed_base(t) for t in tbs]) 539 541 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) 545 557 else: 546 558 self.insert_internet_portals(s, topo, tbs, tbparams, masters, 547 559 eid, segment_substrate, portals, connInfo, expid) 560 548 561 549 562 # Make sure that all the service importers have a control portal back … … 560 573 e.get_attribute('portal_type') == 'both']) == 0: 561 574 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 641 661 else: 642 662 self.add_control_portal(mtb, tb, masters, eid, topo,
Note: See TracChangeset
for help on using the changeset viewer.