Changeset 7a8d667
- Timestamp:
- Sep 19, 2008 6:25:54 PM (16 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 01073f7
- Parents:
- 9d207bd
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_bindings.wsdl
r9d207bd r7a8d667 122 122 </fault> 123 123 </operation> 124 <operation name="Terminate"> 125 <documentation> 126 The bindings of this operation are straightforward SOAP RPC 1.1. 127 </documentation> 128 <soap:operation soapAction="Terminate"/> 129 <input> 130 <soap:body use="encoded" parts="tns:TerminateRequestBody" 131 namespace="http://www.isi.edu/faber/fedd.wsdl" 132 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 133 </input> 134 <output> 135 <soap:body use="encoded" parts="tns:TerminateResponseBody" 136 namespace="http://www.isi.edu/faber/fedd.wsdl" 137 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 138 </output> 139 <fault> 140 <soap:fault use="encoded" name="tns:FeddFault" 141 namespace="http://www.isi.edu/faber/fedd.wsdl" 142 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 143 </fault> 144 </operation> 124 145 </binding> 125 146 -
fedd/fedd_client.py
r9d207bd r7a8d667 425 425 print resp_dict 426 426 427 class terminate(fedd_rpc): 428 def __init__(self): 429 """ 430 Termination request 431 """ 432 433 fedd_rpc.__init__(self, "Terminate") 434 435 def __call__(self): 436 """ 437 The control flow. Compose the request and print the response. 438 """ 439 # Process the options using the customized option parser defined above 440 parser = fedd_exp_data_opts() 441 442 (opts, args) = parser.parse_args() 443 444 if opts.trusted != None: 445 if ( not os.access(opts.trusted, os.R_OK) ) : 446 sys.exit("Cannot read trusted certificates (%s)" % opts.trusted) 447 else: 448 parser.error("--trusted is required") 449 450 if opts.debug > 0: opts.tracefile=sys.stderr 451 452 if opts.cert != None: cert = opts.cert 453 454 if cert == None: 455 sys.exit("No certificate given (--cert) or found") 456 457 if os.access(cert, os.R_OK): 458 fid = fedid(file=cert) 459 else: 460 sys.exit("Cannot read certificate (%s)" % cert) 461 462 if opts.exp_name and opts.exp_certfile: 463 sys.exit("Only one of --experiment_cert and " +\ 464 "--experiment_name permitted"); 465 466 if opts.exp_certfile: 467 exp_id = { 'fedid': fedid(file=opts.exp_certfile) } 468 469 if opts.exp_name: 470 exp_id = { 'localname' : opts.exp_name } 471 472 req = { 'experiment': exp_id } 473 474 try: 475 resp_dict = self.do_rpc(req, 476 opts.url, opts.transport, cert, opts.trusted, 477 serialize_only=opts.serialize_only, 478 tracefile=opts.tracefile) 479 except self.RPCException, e: 480 exit_with_fault(\ 481 {'desc': e.desc, 'errstr': e.errstr, 'code': e.code}) 482 except RuntimeError, e: 483 print e 484 sys.exit("Error processing RPC: %s" % e) 485 486 eid = resp_dict.get('experimentID', None) 487 if eid: 488 for id in eid: 489 for k in id.keys(): 490 if k == 'fedid': print "%s: %s" % (k,fedid(bits=id[k])) 491 else: print "%s: %s" % (k, id[k]) 492 427 493 class create(fedd_rpc): 428 494 def __init__(self): … … 637 703 'vis': exp_data('Vis'),\ 638 704 'info': exp_data('Info'),\ 705 'terminate': terminate(),\ 639 706 } 640 707 -
fedd/fedd_create_experiment.py
r9d207bd r7a8d667 32 32 scripts = ["fed_bootstrap", "federate.sh", "smbmount.FreeBSD.pl", 33 33 "smbmount.Linux.pl", "make_hosts", "fed-tun.pl", "fed-tun.ucb.pl", 34 "fed_evrepeater", "rc.accounts.patch", "daemon.py", 35 "experiment-setup.py"] 34 "fed_evrepeater", "rc.accounts.patch"] 36 35 37 36 def __init__(self, … … 693 692 "emulab" : e 694 693 } 694 # Make the testbed name be the label the user applied 695 p['testbed'] = {'localname': tb } 695 696 696 697 for u in p['user']: … … 1400 1401 raise service_error(service_error.req, "No such experiment") 1401 1402 1403 1404 1405 def terminate_experiment(self, req, fid): 1406 tbparams = { } 1407 req = req.get('TerminateRequestBody', None) 1408 if not req: 1409 raise service_error(service_error.req, 1410 "Bad request format (no TerminateRequestBody)") 1411 exp = req.get('experiment', None) 1412 if exp: 1413 if exp.has_key('fedid'): 1414 key = fedid(bits=exp['fedid']) 1415 keytype = "fedid" 1416 elif exp.has_key('localname'): 1417 key = exp['localname'] 1418 keytype = "localname" 1419 else: 1420 raise service_error(service_error.req, "Unknown lookup type") 1421 else: 1422 raise service_error(service_error.req, "No request?") 1423 1424 fed_exp = self.state.get(key, None) 1425 1426 if fed_exp: 1427 # Construct enough of the tbparams to make the stop_segment calls 1428 # work 1429 for fed in fed_exp['federant']: 1430 try: 1431 for e in fed['name']: 1432 eid = e.get('localname', None) 1433 if eid: break 1434 else: 1435 continue 1436 1437 p = fed['emulab']['project'] 1438 1439 project = p['name']['localname'] 1440 tb = p['testbed']['localname'] 1441 user = p['user'][0]['userID']['localname'] 1442 1443 domain = fed['emulab']['domain'] 1444 host = "%s%s" % (fed['emulab']['ops'], domain) 1445 except KeyError, e: 1446 continue 1447 tbparams[tb] = {\ 1448 'user': user,\ 1449 'domain': domain,\ 1450 'project': project,\ 1451 'host': host,\ 1452 'eid': eid,\ 1453 } 1454 # Stop everyone. 1455 for tb in tbparams.keys(): 1456 self.stop_segment(tb, tbparams[tb]['eid'], tbparams) 1457 return { 'experiment': exp } 1458 else: 1459 raise service_error(service_error.req, "No saved state") 1460 1461 1462 1463 1402 1464 if __name__ == '__main__': 1403 1465 from optparse import OptionParser -
fedd/fedd_messages.wsdl
r9d207bd r7a8d667 47 47 </message> 48 48 49 50 <message name="TerminateRequestMessage"> 51 <part name="TerminateRequestBody" type="xsd1:terminateRequestType"/> 52 </message> 53 54 <message name="TerminateResponseMessage"> 55 <part name="TerminateResponseBody" type="xsd1:terminateResponseType"/> 56 </message> 57 49 58 <message name="FaultMessage"> 50 59 <part name="FaultBody" type="xsd1:faultType"/> … … 92 101 <fault name="FeddFault" message="tns:FaultMessage"/> 93 102 </operation> 103 <operation name="Terminate"> 104 <documentation> 105 Fill this in 106 </documentation> 107 <input message="tns:TerminateRequestMessage"/> 108 <output message="tns:TerminateResponseMessage"/> 109 <fault name="FeddFault" message="tns:FaultMessage"/> 110 </operation> 94 111 </portType> 95 112 </definitions> -
fedd/fedd_proj.py
r9d207bd r7a8d667 51 51 'Vis' : 'soap_Vis',\ 52 52 'Info' : 'soap_Info',\ 53 'Terminate' : 'soap_Terminate',\ 53 54 } 54 55 xmlrpc_methods = { \ … … 58 59 'Vis' : 'xmlrpc_Vis',\ 59 60 'Info' : 'xmlrpc_Info',\ 61 'Terminate' : 'xmlrpc_Terminate',\ 60 62 } 61 63 … … 613 615 return resp 614 616 617 def soap_Terminate(self, ps, fid): 618 req = ps.Parse(TerminateRequestMessage.typecode) 619 620 msg = self.create_experiment.terminate_experiment(unpack_soap(req), 621 fedid) 622 623 resp = TerminateResponseMessage() 624 resp.set_element_TerminateResponseBody( 625 pack_soap(resp, "TerminateResponseBody", msg)) 626 627 return resp 628 615 629 def xmlrpc_RequestAccess(self, params, fid): 616 630 msg = self.RequestAccess(params[0], fedid) … … 660 674 if msg != None: 661 675 return encapsulate_binaries({ "InfoResponseBody" : msg }, 676 ('fedid',)) 677 else: 678 raise service_error(service_error.internal, 679 "No response generated?!") 680 681 682 def xmlrpc_Terminate(self, params, fid): 683 p = decapsulate_binaries(params[0], ('fedid',)) 684 msg = self.create_experiment.terminate_experiment(p, fedid) 685 if msg != None: 686 return encapsulate_binaries({ "TerminateResponseBody" : msg }, 662 687 ('fedid',)) 663 688 else: -
fedd/fedd_types.xsd
r9d207bd r7a8d667 420 420 </xsd:sequence> 421 421 </xsd:complexType> 422 423 <xsd:complexType name="terminateRequestType"> 424 <xsd:annotation> 425 <xsd:documentation> 426 Request to terminate an experiment 427 </xsd:documentation> 428 </xsd:annotation> 429 <xsd:sequence> 430 <xsd:element name="experiment" type="tns:IDType"/> 431 </xsd:sequence> 432 </xsd:complexType> 433 434 <xsd:complexType name="terminateResponseType"> 435 <xsd:annotation> 436 <xsd:documentation> 437 Request to terminate an experiment 438 </xsd:documentation> 439 </xsd:annotation> 440 <xsd:sequence> 441 <xsd:element name="experiment" type="tns:IDType"/> 442 </xsd:sequence> 443 </xsd:complexType> 444 422 445 423 446 <xsd:complexType name="faultType"> -
fedkit/fed-tun.pl
r9d207bd r7a8d667 21 21 use Sys::Hostname; 22 22 use IO::File; 23 use File::Copy; 23 24 24 25 my $IFCONFIG = "/sbin/ifconfig"; … … 29 30 my $ROUTE_GET = "/sbin/route get"; # XXX: works on FreeBSD, but should 30 31 # should be 'ip route get' for Linux 32 my $sshd_config = "/etc/ssh/sshd_config"; # Probably should be a param 31 33 32 34 # Ports that are forwarded between testbeds … … 71 73 my $remote_config_file; # Config file for the other side 72 74 73 if ($#ARGV != 0 && !getopts('df:r ', \%opts)) {75 if ($#ARGV != 0 && !getopts('df:rn', \%opts)) { 74 76 die "$usage"; 75 77 } … … 132 134 } 133 135 134 @ssh_port_fwds = () if ($opts{'type'} eq 'experiment'); 136 # -n just starts the ssh tap tunnel 137 @ssh_port_fwds = () if ($opts{'type'} eq 'experiment' || $opts{'n'}); 135 138 136 139 print "ssh_port_fwds = ", join("\n",@ssh_port_fwds), "\n" if ($debug); 137 140 } 141 142 # Both sides need to have GatewayPorts to be set. Copy the existing 143 # sshd_config, making sure GatewayPorts is set to yes, replace the original, 144 # and restart sshd. 145 my $ports_on = 0; 146 147 my $conf = new IO::File($sshd_config) || die "Can't open $sshd_config: $!\n"; 148 my $new_conf = new IO::File(">/tmp/sshd_config") || 149 die "Can't open new ssh_config: $!\n"; 150 151 while(<$conf>) { 152 s/^\s*GatewayPorts.*/GatewayPorts yes/ && do { 153 print $new_conf $_ unless $ports_on++; 154 next; 155 }; 156 print $new_conf $_; 157 } 158 print $new_conf "GatewayPorts yes\n" unless $ports_on; 159 $conf->close(); 160 $new_conf->close(); 161 162 copy("/tmp/sshd_config", $sshd_config) || 163 die "Cannot replace $sshd_config: $!\n"; 164 165 system("/etc/rc.d/sshd restart"); 138 166 139 167 # Need these to make the Ethernet tap and bridge to work... -
fedkit/fed-tun.ucb.pl
r9d207bd r7a8d667 30 30 my $ROUTE_GET = "/sbin/route get"; # XXX: works on FreeBSD, but should 31 31 # should be 'ip route get' for Linux 32 my $sshd_config = "/etc/ssh/sshd_config"; # Probably should be a param 32 33 33 34 # Ports that are forwarded between testbeds … … 131 132 } 132 133 134 # Both sides need to have GatewayPorts to be set. Copy the existing 135 # sshd_config, making sure GatewayPorts is set to yes, replace the original, 136 # and restart sshd. 137 my $ports_on = 0; 138 139 my $conf = new IO::File($sshd_config) || die "Can't open $sshd_config: $!\n"; 140 my $new_conf = new IO::File(">/tmp/sshd_config") || 141 die "Can't open new ssh_config: $!\n"; 142 143 while(<$conf>) { 144 s/^\s*GatewayPorts.*/GatewayPorts yes/ && do { 145 print $new_conf $_ unless $ports_on++; 146 next; 147 }; 148 print $new_conf $_; 149 } 150 print $new_conf "GatewayPorts yes\n" unless $ports_on; 151 $conf->close(); 152 $new_conf->close(); 153 154 copy("/tmp/sshd_config", $sshd_config) || 155 die "Cannot replace $sshd_config: $!\n"; 156 157 system("/etc/rc.d/sshd restart"); 158 159 133 160 # Need these to make the Ethernet tap and bridge to work... 134 161
Note: See TracChangeset
for help on using the changeset viewer.