Changeset 617592b for fedd/federation/experiment_control.py
- Timestamp:
- Feb 20, 2010 5:27:56 PM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 6af3226
- Parents:
- 0f06528
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/experiment_control.py
r0f06528 r617592b 831 831 # Add attributes to parameter space. We don't allow attributes to 832 832 # overlay any parameters already installed. 833 for a in r ['fedAttr']:833 for a in r.get('fedAttr', []): 834 834 try: 835 835 if a['attribute'] and \ … … 923 923 try: 924 924 self.log.debug("Calling StartSegment at %s " % uri) 925 print req926 925 r = self.caller(uri, req, self.cert_file, self.cert_pwd, 927 926 self.trusted_certs) … … 1039 1038 vlan = get_vlan(ss.response) 1040 1039 if vlan is not None: 1041 for k, t in topo.items():1042 for e in t.elements:1043 for i in e.interface:1044 vl = i.get_attribute('dragon_vlan')1045 if vl is not None and vl== to_repl:1046 i.set_attribute('dragon_vlan', vlan)1040 for v in connInfo.values(): 1041 for i in v: 1042 for a in i.get('fedAttr', []): 1043 if a.get('attribute', "") == 'vlan_id' and \ 1044 a.get('value', "") == to_repl: 1045 a['value'] = vlan 1047 1046 else: 1048 1047 break … … 1355 1354 ) 1356 1355 ifaces.append(inf) 1357 info = { 1358 "type" : conn_type, 1359 "portal": myname, 1360 'peer': desthost, 1361 'fedAttr': [ 1362 { 'attribute': 'masterdomain', 'value': mdomain}, 1363 { 'attribute': 'masterexperiment', 'value': 1364 "%s/%s" % (mproject, eid)}, 1365 { 'attribute': 'active', 'value': active}, 1366 # Move to SMB service description 1367 { 'attribute': 'masteruser', 'value': muser}, 1368 { 'attribute': 'smbshare', 'value': smbshare}, 1369 ], 1370 } 1371 1372 if conn_type == 'transit': 1373 info['member'] = [ { 'element': myname, 'interface': 'inf000'} ] 1374 if conn_attrs: 1375 info['fedAttr'].extend(con_attrs) 1356 if conn_type == "ssh": 1357 info = { 1358 "type" : conn_type, 1359 "portal": myname, 1360 'peer': desthost, 1361 'fedAttr': [ 1362 { 'attribute': 'masterdomain', 'value': mdomain}, 1363 { 'attribute': 'masterexperiment', 'value': 1364 "%s/%s" % (mproject, eid)}, 1365 { 'attribute': 'active', 'value': active}, 1366 # Move to SMB service description 1367 { 'attribute': 'masteruser', 'value': muser}, 1368 { 'attribute': 'smbshare', 'value': smbshare}, 1369 ], 1370 } 1371 else: 1372 info = None 1376 1373 1377 1374 return (topdl.Computer( … … 1455 1452 1456 1453 def create_dragon_substrate(self, sub, topo, tbs, tbparams, master, eid, 1457 connInfo ):1454 connInfo, peer={ }): 1458 1455 """ 1459 1456 Add attribiutes to the various elements indicating that they are to be … … 1467 1464 else: return None 1468 1465 1466 mdomain = tbparams[master].get('domain', '.example.com') 1467 mproject = tbparams[master].get('project', 'project') 1469 1468 # dn is the number of previously created dragon nets. This routine 1470 1469 # creates a net numbered by dn … … 1473 1472 # the global topology 1474 1473 count = { } 1474 node = { } 1475 1475 for e in [ i.element for i in sub.interfaces ]: 1476 1476 tb = e.get_attribute('testbed') 1477 1477 count[tb] = count.get(tb, 0) + 1 1478 node[tb] = i.get_attribute('ip4_address') 1479 1478 1480 1479 1481 # Set the attributes in the copies that will allow setup of dragon … … 1484 1486 if not connInfo.has_key(tb): 1485 1487 connInfo[tb] = [ ] 1488 1489 # This may need another look, but only a service gateway will 1490 # look at the active parameter, and these are only inserted to 1491 # connect to the master. 1492 active = "%s" % ( tb == 'master') 1486 1493 info = { 1487 1494 'type': 'transit', … … 1489 1496 'element': i.element.name[0], 1490 1497 'interface': i.name 1491 } for i in s.interfaces ], 1492 'fedAttr': [ { 1493 'attribute': 'vlan_id', 1494 'value': 'unassigned%d' % dn 1495 } ] 1498 } for i in s.interfaces \ 1499 if isinstance(i.element, topdl.Computer) ], 1500 'fedAttr': [ 1501 { 'attribute': 'vlan_id', 1502 'value': 'unassigned%d' % dn }, 1503 { 'attribute': 'masterdomain', 'value': mdomain}, 1504 { 'attribute': 'masterexperiment', 'value': 1505 "%s/%s" % (mproject, eid)}, 1506 { 'attribute': 'active', 'value': active}, 1507 ], 1496 1508 } 1509 if peer.has_key(tb): 1510 info['peer'] = peer[tb] 1497 1511 connInfo[tb].append(info) 1498 1512 else: … … 1631 1645 ('portal','true'), 1632 1646 ('ip4_address', "%s" % ip_addr(myip)),)),), 1633 conn_type="transit", 1634 conn_attrs = [ { 1635 'attribute': 'vlan_id', 'value': 'unassigned%d' % idx 1636 }]) 1647 conn_type="transit") 1637 1648 if self.fedkit: 1638 1649 self.add_kit(portal, self.fedkit) … … 1640 1651 self.add_kit(portal, self.gatewaykit) 1641 1652 1642 return portal , info1653 return portal 1643 1654 1644 1655 def add_portals(self, top, topo, eid, master, tbparams, ip_allocator, … … 1721 1732 ], 1722 1733 ) 1723 portal , info= self.new_dragon_portal(tb, master,1734 portal = self.new_dragon_portal(tb, master, 1724 1735 master, eid, dip, mip, idx, csub, tbparams) 1725 1736 topo[tb].substrates.append(csub) 1726 1737 topo[tb].elements.append(portal) 1727 1738 topo[tb].elements.append(seg) 1728 if not connInfo.has_key(tb):1729 connInfo[tb] = [info]1730 else:1731 connInfo[tb].append(info)1732 1739 1733 1740 mcsub = csub.clone() … … 1752 1759 ], 1753 1760 ) 1754 portal , info= self.new_dragon_portal(master, tb, master,1761 portal = self.new_dragon_portal(master, tb, master, 1755 1762 eid, mip, dip, idx, mcsub, tbparams) 1756 1763 topo[master].substrates.append(mcsub) 1757 1764 topo[master].elements.append(portal) 1758 1765 topo[master].elements.append(seg) 1759 if not connInfo.has_key(master): 1760 connInfo[master] = [info] 1761 else: 1762 connInfo[master].append(info) 1766 for t in (master, tb): 1767 topo[t].incorporate_elements() 1763 1768 1764 1769 self.create_dragon_substrate(csub, topo, 1765 {tb: 1, master:1}, tbparams, master, eid) 1770 {tb: 1, master:1}, tbparams, master, eid, connInfo, 1771 {tb: ip_addr(mip), master: ip_addr(dip)}) 1766 1772 else: 1767 1773 self.add_control_portal(master, tb, master, eid, topo, … … 2104 2110 tb = t.get_attribute('testbed') 2105 2111 if tb: 2106 self.get_access(tb, None, user,tbparams, master,2112 self.get_access(tb, None, tbparams, master, 2107 2113 export_project, access_user, services) 2108 2114 tbparams[k] = tbparams[tb] … … 2196 2202 ] 2197 2203 2204 # transit and disconnected testbeds may not have a connInfo entry. 2205 # Fill in the blanks. 2206 for t in allocated.keys(): 2207 if not connInfo.has_key(t): 2208 connInfo[t] = { } 2209 2198 2210 # Start a thread to do the resource allocation 2199 2211 t = Thread(target=self.allocate_resources,
Note: See TracChangeset
for help on using the changeset viewer.