Changeset 5334044
- Timestamp:
- May 27, 2010 2:25:36 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 1962a5b
- Parents:
- 0de1b94
- Location:
- fedd/federation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/emulab_access.py
r0de1b94 r5334044 131 131 # XXX: Configurable 132 132 self.exports = set(('SMB', 'seer', 'tmcd', 'userconfig', 133 'project_export', 'local_seer_control', 'seer_master')) 134 self.imports = set(('SMB', 'seer', 'userconfig', 'seer_master')) 133 'project_export', 'local_seer_control', 'seer_master', 134 'hide_hosts')) 135 self.imports = set(('SMB', 'seer', 'userconfig', 'seer_master', 136 'hide_hosts')) 135 137 136 138 if not self.local_seer_image or not self.local_seer_software: … … 583 585 return confid, confcert 584 586 585 def export_SMB(self, id, state, project, user ):587 def export_SMB(self, id, state, project, user, attrs): 586 588 return { 587 589 'id': id, … … 596 598 } 597 599 598 def export_seer(self, id, state, project, user ):600 def export_seer(self, id, state, project, user, attrs): 599 601 return { 600 602 'id': id, … … 604 606 } 605 607 606 def export_local_seer(self, id, state, project, user ):608 def export_local_seer(self, id, state, project, user, attrs): 607 609 return { 608 610 'id': id, … … 612 614 } 613 615 614 def export_seer_master(self, id, state, project, user ):616 def export_seer_master(self, id, state, project, user, attrs): 615 617 return { 616 618 'id': id, … … 620 622 } 621 623 622 def export_tmcd(self, id, state, project, user ):624 def export_tmcd(self, id, state, project, user, attrs): 623 625 return { 624 626 'id': id, … … 628 630 } 629 631 630 def export_userconfig(self, id, state, project, user ):632 def export_userconfig(self, id, state, project, user, attrs): 631 633 if self.userconfdir and self.userconfcmd \ 632 634 and self.userconfurl: … … 645 647 return None 646 648 649 def export_hide_hosts(self, id, state, project, user, attrs): 650 return { 651 'id': id, 652 'name': 'hide_hosts', 653 'visibility': 'export', 654 'fedAttr': [ x for x in attrs \ 655 if x.get('attribute', "") == 'hosts'], 656 } 657 647 658 def export_services(self, sreq, project, user): 648 659 exp = [ ] … … 653 664 sname = s.get('name', '') 654 665 svis = s.get('visibility', '') 666 sattrs = s.get('fedAttr', []) 655 667 if svis == 'export': 656 668 if sname in self.exports: 657 669 id = s.get('id', 'no_id') 658 670 if sname == 'SMB': 659 exp.append(self.export_SMB(id, state, project, user)) 671 exp.append(self.export_SMB(id, state, project, user, 672 sattrs)) 660 673 elif sname == 'seer': 661 exp.append(self.export_seer(id, state, project, user)) 674 exp.append(self.export_seer(id, state, project, user, 675 sattrs)) 662 676 elif sname == 'tmcd': 663 exp.append(self.export_tmcd(id, state, project, user)) 677 exp.append(self.export_tmcd(id, state, project, user, 678 sattrs)) 664 679 elif sname == 'userconfig': 665 680 exp.append(self.export_userconfig(id, state, 666 project, user ))681 project, user, sattrs)) 667 682 elif sname == 'project_export': 668 exp.append(self.export_SMB(id, state, project, user)) 669 #exp.append(self.export_seer(id, state, project, user)) 683 exp.append(self.export_SMB(id, state, project, user, 684 sattrs)) 685 #exp.append(self.export_seer(id, state, project, user, 686 #sattrs)) 670 687 exp.append(self.export_userconfig(id, state, 671 project, user ))688 project, user, sattrs)) 672 689 elif sname == 'local_seer_control': 673 690 exp.append(self.export_local_seer(id, state, project, 674 user ))691 user, sattrs)) 675 692 elif sname == 'seer_master': 676 693 exp.append(self.export_seer_master(id, state, project, 677 user)) 694 user, sattrs)) 695 elif sname == 'hide_hosts': 696 exp.append(self.export_hide_hosts(id, state, project, 697 user, sattrs)) 678 698 return (exp, state) 679 699 … … 1094 1114 print >>f, "ProjectName: %s" % smbproj 1095 1115 1116 def client_hide_hosts(f, s): 1117 for a in s.get('fedAttr', [ ]): 1118 if a.get('attribute', "") == 'hosts': 1119 print >>f, "Hide: %s" % a.get('value', "") 1120 1096 1121 client_service_out = { 1097 1122 'SMB': client_smb, … … 1101 1126 'project_export': client_null, 1102 1127 'seer_master': client_seer_master, 1128 'hide_hosts': client_hide_hosts, 1103 1129 } 1104 1130 … … 1130 1156 'seer': server_seer, 1131 1157 'seer_master': server_port, 1158 'hide_hosts': server_null, 1132 1159 } 1133 1160 # XXX: end un hardcode this -
fedd/federation/experiment_control.py
r0de1b94 r5334044 46 46 # Right now, no support for composition. 47 47 class federated_service: 48 def __init__(self, name, exporter=None, importers=[], params={ }, reqs=[]): 48 def __init__(self, name, exporter=None, importers=None, params=None, 49 reqs=None, portal=None): 49 50 self.name=name 50 51 self.exporter=exporter 51 self.importers=importers 52 self.params = params 53 self.reqs = reqs 52 if importers is None: self.importers = [] 53 else: self.importers=importers 54 if params is None: self.params = { } 55 else: self.params = params 56 if reqs is None: self.reqs = [] 57 else: self.reqs = reqs 58 59 if portal is not None: 60 self.portal = portal 61 else: 62 self.portal = (name in federated_service.needs_portal) 54 63 55 64 def __str__(self): … … 57 66 (self.name, self.exporter, self.importers, self.params, 58 67 [ (r['name'], r['visibility']) for r in self.reqs] ) 68 69 needs_portal = ('SMB', 'seer', 'tmcd', 'project_export', 'seer_master') 59 70 60 71 class experiment_control_local: … … 1689 1700 if a.attribute == 'testbed']) 1690 1701 1702 tb_hosts = { } 1703 for tb in testbeds: 1704 tb_hosts[tb] = [ e.name for e in top.elements \ 1705 if isinstance(e, topdl.Computer) and \ 1706 e.get_attribute('testbed') and \ 1707 e.get_attribute('testbed') == tb] 1708 1691 1709 masters = { } # testbeds exporting services 1710 pmasters = { } # Testbeds exporting services that 1711 # need portals 1692 1712 for s in tb_services: 1693 # If this is a project_exportrequest with the importall field1713 # If this is a service request with the importall field 1694 1714 # set, fill it out. 1695 1715 … … 1711 1731 a.get('value','') 1712 1732 1713 masters[tb].append(federated_service(name=s['name'],1733 fser = federated_service(name=s['name'], 1714 1734 exporter=tb, importers=s.get('import',[]), 1715 params=params, reqs=[])) 1735 params=params) 1736 if fser.name == 'hide_hosts' \ 1737 and 'hosts' not in fser.params: 1738 fser.params['hosts'] = \ 1739 ",".join(tb_hosts.get(fser.exporter, [])) 1740 masters[tb].append(fser) 1741 1742 if fser.portal: 1743 if tb not in pmasters: pmasters[tb] = [ fser ] 1744 else: pmasters[tb].append(fser) 1716 1745 else: 1717 1746 self.log.error('Testbed service does not have name " + \ … … 1722 1751 topo ={ } # Sub topologies 1723 1752 connInfo = { } # Connection information 1753 1724 1754 self.get_access_to_testbeds(testbeds, access_user, allocated, 1725 1755 tbparams, masters) … … 1761 1791 part = experiment_partition(self.auth, self.store_url, self.tbmap, 1762 1792 self.muxmax, self.direct_transit) 1763 part.add_portals(top, topo, eid, masters, tbparams, ip_allocator,1793 part.add_portals(top, topo, eid, pmasters, tbparams, ip_allocator, 1764 1794 connInfo, expid) 1765 1795 # Now get access to the dynamic testbeds (those added above)
Note: See TracChangeset
for help on using the changeset viewer.