Changeset 1da6a23
- Timestamp:
- Sep 4, 2009 5:04:07 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-2.00, version-3.01, version-3.02
- Children:
- 5ae3857
- Parents:
- f5ae004
- Location:
- fedd/federation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/access.py
rf5ae004 r1da6a23 10 10 from threading import * 11 11 import subprocess 12 import signal 12 13 import time 13 14 … … 1110 1111 1111 1112 seer_out = False 1113 client_out = False 1112 1114 for p in [ e for e in topo.elements \ 1113 1115 if isinstance(e, topdl.Computer) and e.get_attribute('portal')]: … … 1120 1122 mproj, meid = mexp.split("/", 1) 1121 1123 mdomain = e.get_attribute('masterdomain') 1124 muser = e.get_attribute('masteruser') or 'root' 1125 smbshare = e.get_attribute('smbshare') or 'USERS' 1122 1126 scriptdir = e.get_attribute('scriptdir') 1123 1127 active = e.get_attribute('active') … … 1136 1140 rdomain = seg.get_attribute('domain') 1137 1141 cfn = "%s/%s.%s.%s%s.gw.conf" % \ 1138 (tmpdir, myname, leid, lproj, ldomain) 1142 (tmpdir, myname.lower(), leid.lower(), 1143 lproj.lower(), ldomain.lower()) 1144 tunnelconfig = self.attrs.has_key('TunnelCfg') 1139 1145 try: 1140 1146 f = open(cfn, "w") 1141 1147 print >>f, "Active: %s" % active 1148 print >>f, "TunnelCfg: %s" % tunnelconfig 1142 1149 print >>f, "BossName: boss" 1143 1150 print >>f, "FsName: fs" … … 1155 1162 print >>f, "Peer: %s.%s.%s%s" % \ 1156 1163 (peer.lower(), reid.lower(), rproj.lower(), rdomain) 1164 print >>f, "RemoteScriptDir: %s" % scriptdir 1157 1165 print >>f, "Pubkeys: /proj/%s/exp/%s/tmp/%s" % \ 1158 1166 (lproj, leid, pubkey_base) 1159 print >>f, "Privkey : /proj/%s/exp/%s/tmp/%s" % \1167 print >>f, "Privkeys: /proj/%s/exp/%s/tmp/%s" % \ 1160 1168 (lproj, leid, secretkey_base) 1161 1169 f.close() … … 1179 1187 seer_out = True 1180 1188 1181 1182 def generate_client_conf(self, user, proj, eid, tmpdir): 1183 try: 1184 f = open("%s/client.conf" % tmpdir, "w") 1185 if self.attrs.has_key('SMBshare'): 1186 print >>f, "SMBshare: %s" % self.attrs['SMBshare'] 1187 print >>f, "ProjectUser: %s" % user 1188 print >>f, "ProjectName: %s" % proj 1189 print >>f, "ExperimentID: %s/%s" % (proj, eid) 1190 f.close() 1191 except IOError, e: 1192 raise service_error(service_error.internal, 1193 "Cannot write client.conf: %s" %s) 1189 if not client_out and type in ('control', 'both'): 1190 try: 1191 f = open("%s/client.conf" % tmpdir, "w") 1192 print >>f, "ControlGateway: %s.%s.%s%s" % \ 1193 (myname.lower(), leid.lower(), lproj.lower(), 1194 ldomain.lower()) 1195 print >>f, "SMBshare: %s" % smbshare 1196 print >>f, "ProjectUser: %s" % muser 1197 print >>f, "ProjectName: %s" % mproj 1198 print >>f, "ExperimentID: %s/%s" % (mproj, meid) 1199 f.close() 1200 except IOError, e: 1201 raise service_error(service_error.internal, 1202 "Cannot write client.conf: %s" %s) 1203 client_out = True 1204 1205 1194 1206 1195 1207 def generate_ns2(self, topo, expfn, softdir, master): … … 1214 1226 s.location = re.sub("^.*/", softdir, s.location) 1215 1227 1216 1217 1228 # Customize the ns2 output for local portal commands and images 1218 1229 filters = [] … … 1340 1351 self.generate_ns2(topo, expfile, 1341 1352 "/proj/%s/software/%s/" % (proj, ename), master) 1342 self.generate_client_conf(user, proj, ename, tmpdir)1343 1353 starter = self.start_segment(keyfile=self.ssh_privkey_file, debug=False) 1344 1354 starter(self, ename, proj, user, expfile, tmpdir) -
fedd/federation/experiment_control.py
rf5ae004 r1da6a23 2619 2619 ddomain = tbparams[dt].get('domain', ".example.com") 2620 2620 mdomain = tbparams[master].get('domain', '.example.com') 2621 muser = tbparams[master].get('user', 'root') 2622 smbshare = tbparams[master].get('smbshare', 'USERS') 2621 2623 # XXX: active and type need to be unkludged 2622 2624 active = ("%s" % (st == master)) … … 2661 2663 ('masterexperiment', "%s/%s" % \ 2662 2664 (mproject, eid)), 2665 ('masteruser', muser), 2666 ('smbshare', smbshare), 2663 2667 ('experiment', "%s/%s" % \ 2664 2668 (sproject, eid)), … … 2677 2681 attribute=[ 2678 2682 topdl.Attribute( 2679 attribute='ip4_addre ess',2683 attribute='ip4_address', 2680 2684 value=tbs[dt] 2681 2685 ) -
fedd/federation/topdl.py
rf5ae004 r1da6a23 613 613 614 614 615 def topology_to_ns2(t, filters=[] ):615 def topology_to_ns2(t, filters=[], routing="Session"): 616 616 out = """ 617 617 set ns [new Simulator] … … 668 668 for i in s.interfaces: 669 669 e = i.element 670 ip = e.get_attribute("ip4_address")670 ip = i.get_attribute("ip4_address") 671 671 if ip: 672 out += "tb-set-ip-lan $%s $%s %s\n" % (e.name, name, ip) 672 out += "tb-set-ip-lan $%s $%s %s\n" % \ 673 (to_tcl(e.name[0]), name, ip) 673 674 if i.capacity and i.capacity.rate != s.capacity.rate: 674 675 out += "tb-set-node-lan-bandwidth $%s $%s %fkb\n" % \ … … 679 680 iloss = i.get_attribute('loss') 680 681 if loss and iloss != loss : 681 out += "tb-set-node-lan-loss $%s $%s %f " % \682 out += "tb-set-node-lan-loss $%s $%s %f\n" % \ 682 683 (to_tcl_name(e.name[0]), name, float(loss)) 683 684 out+= "\n" … … 712 713 % (name, to_tcl_name(i.element.name[0]), 713 714 delay, cap, loss) 715 ip = i.get_attribute('ip4_address') 716 if ip: 717 out += "tb-set-ip-link $%s $%s %s\n" % \ 718 (to_tcl_name(i.element.name[0]), name, ip) 714 719 out+= "\n" 715 720 for f in filters: 716 721 out+= f(s) 722 out+="$ns rtproto %s" % routing 717 723 out+=""" 718 724 $ns run
Note: See TracChangeset
for help on using the changeset viewer.