- Timestamp:
- Nov 5, 2008 1:37:28 AM (16 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 9c166cf
- Parents:
- 01308c9
- Location:
- fedd
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_client.py
r01308c9 r2c6128f 123 123 type="string", help="Use this username instead of the uid") 124 124 125 class fedd_split_opts(fedd_create_opts): 126 def __init__(self, access_keys, add_key_callback=None, 127 add_cert_callback=None): 128 fedd_create_opts.__init__(self, access_keys, add_key_callback, 129 add_cert_callback) 130 self.add_option('-t','--fedkit', action='store_true', dest='fedkit', 131 default=False, 132 help="get output suitable for federation kit install") 133 134 125 135 class fedd_access_opts(fedd_create_opts): 126 136 def __init__(self, access_keys, node_descs, add_key_callback=None, … … 605 615 access_keys = [] 606 616 # Process the options using the customized option parser defined above 607 parser = fedd_ create_opts(access_keys, self.add_ssh_key,617 parser = fedd_split_opts(access_keys, self.add_ssh_key, 608 618 self.add_x509_cert) 609 619 … … 619 629 620 630 if opts.cert != None: cert = opts.cert 631 else: cert = None 621 632 622 633 if cert == None: … … 650 661 'description': { 'ns2description': exp_desc }, 651 662 'master': opts.master, 663 'include_fedkit': opts.fedkit, 652 664 } 653 665 -
fedd/fedd_experiment_control.py
r01308c9 r2c6128f 45 45 Thred safe. 46 46 """ 47 scripts = ["fed_bootstrap", "federate.sh", "smbmount.FreeBSD.pl",48 "smbmount.Linux.pl", "make_hosts", "fed-tun.pl", "fed-tun.ucb.pl",49 "fed_evrepeater", "rc.accounts.patch"]50 47 51 48 class thread_pool: … … 152 149 Intialize the various attributes, most from the config object 153 150 """ 154 self.scripts = fedd_experiment_control_local.scripts155 151 self.thread_with_rv = fedd_experiment_control_local.pooled_thread 156 152 self.thread_pool = fedd_experiment_control_local.thread_pool … … 190 186 self.state_filename = config.get("experiment_control", 191 187 "experiment_state_file") 192 self.scripts_dir = config.get("experiment_control",193 "federation_script_dir")194 188 self.splitter_url = config.get("experiment_control", "splitter_url") 189 self.fedkit = config.get("experiment_control", "fedkit") 195 190 else: 196 191 self.debug = False 197 192 self.state_filename = None 198 self.scripts_dir = "/users/faber/testbed/federation"199 193 self.splitter_url = None 194 self.fedkit = None 200 195 201 196 # XXX … … 214 209 215 210 self.def_expstart = \ 216 "sudo -H /bin/sh FEDDIR/fed_bootstrap >& /tmp/federate"; 217 self.def_mexpstart = "sudo -H FEDDIR/make_hosts FEDDIR/hosts"; 211 "sudo -H /bin/sh /usr/local/federation/bin/federate.sh >& " +\ 212 "/tmp/federate"; 213 self.def_mexpstart = "sudo -H /usr/local/federation/bin/make_hosts " +\ 214 "FEDDIR/hosts"; 218 215 self.def_gwstart = \ 219 "sudo -H FEDDIR/fed-tun.pl -f GWCONF>& /tmp/bridge.log"; 216 "sudo -H /usr/local/federation/bin/fed-tun.pl -f GWCONF>& " +\ 217 "/tmp/bridge.log"; 220 218 self.def_mgwstart = \ 221 "sudo -H FEDDIR/fed-tun.pl -f GWCONF >& /tmp/bridge.log"; 219 "sudo -H /usr/local/federation/bin/fed-tun.pl -f GWCONF >& " +\ 220 "/tmp/bridge.log"; 222 221 self.def_gwimage = "FBSD61-TUNNEL2"; 223 222 self.def_gwtype = "pc"; … … 233 232 "Cannot read sshpubkey") 234 233 235 # Set the logging level to the value passed in. The getattr slieght of 236 # hand finds the logging level constant corrersponding to the string. 237 # We're a little paranoid to avoid user mayhem. 238 if config.has_option("experiment_control", "log_level"): 239 try: 240 level = int(getattr(logging, 241 config.get("experiment_control", "log_level").upper(),-1)) 242 243 if logging.DEBUG <= level <= logging.CRITICAL: 244 self.log.setLevel(level) 245 else: 246 self.log.error("Bad experiment_log value: %s" % \ 247 config.get("experiment_control", "log_level")) 248 249 except ValueError: 250 self.log.error("Bad experiment_log value: %s" % \ 251 config.experiment_log) 234 set_log_level(config, "experiment_control", self.log) 252 235 253 236 # Grab saved state. OK to do this w/o locking because it's read only … … 256 239 if self.state_filename: 257 240 self.read_state() 258 259 # Confirm federation scripts in the right place260 for s in self.scripts:261 if not os.path.exists(self.scripts_dir + "/" + s):262 raise service_error(service_error.server_config,263 "%s/%s not in local script dir" % (self.scripts_dir, s))264 241 265 242 # Dispatch tables … … 408 385 return True 409 386 410 def ship_scripts(self, host, user, dest_dir):411 """412 Copy the federation scripts (fedkit) to the a federant.413 """414 if self.ssh_cmd(user, host, "mkdir -p %s" % dest_dir):415 for s in self.scripts:416 if not self.scp_file("%s/%s" % (self.scripts_dir, s),417 user, host, dest_dir):418 return False419 return True420 else:421 return False422 423 387 def ship_configs(self, host, user, src_dir, dest_dir): 424 388 """ … … 520 484 "%s/%s" % (proj_dir, f)): 521 485 return False 522 if not self.ship_scripts(host, user, proj_dir):523 return False524 486 if not self.ship_configs(host, user, "%s/%s" % (tmpdir, tb), 525 487 proj_dir): … … 545 507 "%s/%s" % (proj_dir, f)): 546 508 return False 547 if not self.ship_scripts(host, user, proj_dir):548 return False549 509 if not self.ship_configs(host, user, "%s/%s" % (tmpdir, tb), 550 510 proj_dir): … … 593 553 "%s/%s" % (proj_dir, f)): 594 554 return False 595 if not self.ship_scripts(host, user, proj_dir):596 return False597 555 if not self.ship_configs(host, user, "%s/%s" % (tmpdir, tb), 598 556 proj_dir): … … 916 874 'description' : { 'ns2description': desc }, 917 875 'master': master, 876 'include_fedkit': bool(self.fedkit) 918 877 } 919 878 … … 960 919 subsittuted line by line. 961 920 """ 962 def __init__(self, eid, tmpdir ):921 def __init__(self, eid, tmpdir, fedkit): 963 922 self.begin_testbed = re.compile("^#\s+Begin\s+Testbed\s+\((\w+)\)") 964 923 self.end_testbed = re.compile("^#\s+End\s+Testbed\s+\((\w+)\)") … … 978 937 self.eid = eid 979 938 self.tmpdir = tmpdir 939 self.fedkit = fedkit 980 940 981 941 def __call__(self, line, master, allocated, tbparams): … … 1038 998 line = re.sub("GWSTART", gwstart, line) 1039 999 line = re.sub("EXPSTART", expstart, line) 1040 # XXX: does `` embed without doing enything else?1041 1000 line = re.sub("GWCONF", "FEDDIR`hostname`.gw.conf", line) 1042 1001 line = re.sub("PROJDIR", "/proj/%s/" % project, line) … … 1044 1003 line = re.sub("FEDDIR", "/proj/%s/exp/%s/tmp/" % \ 1045 1004 (project, self.eid), line) 1005 if self.fedkit: 1006 line = re.sub("FEDKIT", os.path.basename(self.fedkit), 1007 line) 1046 1008 print >>self.testbed_file, line 1047 1009 return True … … 1077 1039 class gateways: 1078 1040 def __init__(self, eid, master, tmpdir, gw_pubkey, 1079 gw_secretkey, copy_file ):1041 gw_secretkey, copy_file, fedkit): 1080 1042 self.begin_gateways = \ 1081 1043 re.compile("^#\s+Begin\s+gateways\s+\((\w+)\)") … … 1092 1054 1093 1055 self.copy_file = copy_file 1056 self.fedkit = fedkit 1094 1057 1095 1058 … … 1116 1079 seer_control = "%s%s" % \ 1117 1080 (tbparams[gw].get('control', "control"), sdomain) 1118 remote_script_dir = "/proj/%s/exp/%s/tmp" % ( dproject, eid) 1119 local_script_dir = "/proj/%s/exp/%s/tmp" % ( sproject, eid) 1081 1082 if self.fedkit: 1083 remote_script_dir = "/usr/local/federation/bin" 1084 local_script_dir = "/usr/local/federation/bin" 1085 else: 1086 remote_script_dir = "/proj/%s/exp/%s/tmp" % ( dproject, eid) 1087 local_script_dir = "/proj/%s/exp/%s/tmp" % ( sproject, eid) 1088 1089 local_key_dir = "/proj/%s/exp/%s/tmp" % ( sproject, eid) 1090 remote_conf_dir = "/proj/%s/exp/%s/tmp" % ( dproject, eid) 1120 1091 tunnel_cfg = tbparams[gw].get("tun", "false") 1121 1092 … … 1153 1124 print >>gwconfig, "LocalExperiment: %s/%s" % (sproject, eid) 1154 1125 print >>gwconfig, "RemoteConfigFile: %s/%s" % \ 1155 (remote_ script_dir, remote_conf_file)1126 (remote_conf_dir, remote_conf_file) 1156 1127 print >>gwconfig, "Peer: %s%s" % (desthost, ddomain) 1157 print >>gwconfig, "Pubkeys: %s/%s" % (local_ script_dir, pubkey)1158 print >>gwconfig, "Privkeys: %s/%s" % (local_ script_dir, privkey)1128 print >>gwconfig, "Pubkeys: %s/%s" % (local_key_dir, pubkey) 1129 print >>gwconfig, "Privkeys: %s/%s" % (local_key_dir, privkey) 1159 1130 gwconfig.close() 1160 1131 … … 1454 1425 1455 1426 if self.splitter_url: 1427 self.log.debug("Calling remote splitter at %s" % self.splitter_url) 1456 1428 split_data = self.remote_splitter(self.splitter_url, file_content, 1457 1429 master) 1458 1430 else: 1459 1431 tclcmd = [self.tclsh, self.tcl_splitter, '-s', '-x', 1460 str(self.muxmax), '-m', master, pid, gid, eid, tclfile] 1432 str(self.muxmax), '-m', master] 1433 1434 if self.fedkit: 1435 tclcmd.append('-k') 1436 1437 tclcmd.extend([pid, gid, eid, tclfile]) 1438 1439 self.log.debug("running local splitter %s", " ".join(tclcmd)) 1461 1440 tclparser = Popen(tclcmd, stdout=PIPE) 1462 1441 split_data = tclparser.stdout … … 1467 1446 1468 1447 # Objects to parse the splitter output (defined above) 1469 parse_current_testbed = self.current_testbed(eid, tmpdir )1448 parse_current_testbed = self.current_testbed(eid, tmpdir, self.fedkit) 1470 1449 parse_allbeds = self.allbeds(self.get_access) 1471 1450 parse_gateways = self.gateways(eid, master, tmpdir, 1472 gw_pubkey_base, gw_secretkey_base, self.copy_file )1451 gw_pubkey_base, gw_secretkey_base, self.copy_file, self.fedkit) 1473 1452 parse_vtopo = self.shunt_to_string("^#\s+Begin\s+Vtopo", 1474 1453 "^#\s+End\s+Vtopo") … … 1523 1502 # Copy tarfiles and rpms needed at remote sites into a staging area 1524 1503 try: 1504 if self.fedkit: 1505 parse_tarfiles.list.append(self.fedkit) 1525 1506 for t in parse_tarfiles.list: 1526 1507 if not os.path.exists("%s/tarfiles" % tmpdir): -
fedd/fedd_split.py
r01308c9 r2c6128f 35 35 def emit(self, record): pass 36 36 37 fl = logging.getLogger("fedd. experiment_control")37 fl = logging.getLogger("fedd.splitter") 38 38 fl.addHandler(nullHandler()) 39 39 … … 46 46 self.debug = config.getboolean("splitter", "debug") 47 47 self.muxmax = config.getint("splitter", "muxmax", 3) 48 self.tclsh = config.get("splitter", "tclsh", 49 "/usr/local/bin/otclsh") 50 self.tcl_splitter = config.get("splitter", "tcl_splitter", 51 "/usr/testbed/lib/ns2ir/parse.tcl") 48 52 else: 49 53 self.debug = False 50 54 self.muxmax = 3 55 self.tclsh = "/usr/local/bin/otclsh" 56 self.tcl_splitter = "/usr/testbed/lib/ns2ir/parse.tcl" 51 57 52 58 self.log = logging.getLogger("fedd.splitter") 53 self.tclsh = "/usr/local/bin/otclsh"54 self.tcl_splitter = "/usr/testbed/lib/ns2ir/parse.tcl"55 59 self.trace_file = sys.stderr 56 60 61 set_log_level(config, "splitter", self.log) 57 62 # Dispatch tables 58 63 self.soap_services = {\ … … 116 121 raise service_error(service_error.req, "No master testbed label") 117 122 123 include_fedkit = req.get('include_fedkit', None) 124 if include_fedkit == None: 125 raise service_error(service_error.req, 126 "No federation kit inclusion directive") 127 118 128 119 129 tclcmd = [self.tclsh, self.tcl_splitter, '-s', '-x', 120 str(self.muxmax), '-m', master, pid, gid, eid, tclfile] 130 str(self.muxmax), '-m', master] 131 if include_fedkit: tclcmd.append('-k') 132 tclcmd.extend([pid, gid, eid, tclfile]) 133 self.log.debug("Calling splitter %s" % " ".join(tclcmd)) 121 134 tclparser = Popen(tclcmd, stdout=PIPE) 122 135 -
fedd/fedd_types.xsd
r01308c9 r2c6128f 480 480 <xsd:element name="description" type="tns:experimentDescriptionType"/> 481 481 <xsd:element name="master" type="xsd:string"/> 482 <xsd:element name="include_fedkit" type="xsd:bool"/> 482 483 </xsd:sequence> 483 484 </xsd:complexType> -
fedd/fedd_util.py
r01308c9 r2c6128f 4 4 import subprocess 5 5 import tempfile 6 import logging 6 7 7 8 from M2Crypto import SSL, X509, EVP … … 394 395 395 396 return handler 397 398 def set_log_level(config, sect, log): 399 """ Set the logging level to the value passed in sect of config.""" 400 # The getattr sleight of hand finds the logging level constant 401 # corrersponding to the string. We're a little paranoid to avoid user 402 # mayhem. 403 if config.has_option(sect, "log_level"): 404 level_str = config.get(sect, "log_level") 405 try: 406 level = int(getattr(logging, level_str.upper(), -1)) 407 408 if logging.DEBUG <= level <= logging.CRITICAL: 409 log.setLevel(level) 410 else: 411 log.error("Bad experiment_log value: %s" % level_str) 412 413 except ValueError: 414 log.error("Bad experiment_log value: %s" % level_str) 415
Note: See TracChangeset
for help on using the changeset viewer.