Changeset 5f6929a
- Timestamp:
- Apr 7, 2010 1:53:58 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 7fe81be
- Parents:
- 3e3a5de
- Files:
-
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_client.py
r3e3a5de r5f6929a 1443 1443 msg = { 1444 1444 'experimentdescription': { 'ns2description': exp_desc }, 1445 'master': opts.master, 1446 'exportProject': { 'localname': opts.project }, 1445 'service': [ { 'name': 'project_export', 'fedAttr': [ 1446 { 'attribute': 'testbed', 'value': opts.master }, 1447 { 'attribute': 'project', 'value': opts.project }, 1448 ], 1449 'visibility': 'export' }, ] 1447 1450 } 1448 1451 -
fedd/federation/deter_impl.py
r3e3a5de r5f6929a 5 5 import protogeni_access 6 6 from experiment_control import experiment_control_local 7 from split import split_local7 from ns2topdl import ns2topdl_local 8 8 from util import read_simple_accessdb 9 9 from fedid import fedid … … 101 101 self.get_handler = None 102 102 103 if config.has_section(" splitter"):104 self. splitter = split_local(config, self.auth)105 self.soap_services.update(self. splitter.soap_services)106 self.xmlrpc_services.update(self. splitter.xmlrpc_services)103 if config.has_section("ns2topdl"): 104 self.ns2topdl = ns2topdl_local(config, self.auth) 105 self.soap_services.update(self.ns2topdl.soap_services) 106 self.xmlrpc_services.update(self.ns2topdl.xmlrpc_services) 107 107 108 108 def new_feddservice(config): -
fedd/federation/experiment_control.py
r3e3a5de r5f6929a 184 184 call_StartSegment = service_caller('StartSegment') 185 185 call_TerminateSegment = service_caller('TerminateSegment') 186 call_Ns2 Split = service_caller('Ns2Split')186 call_Ns2Topdl = service_caller('Ns2Topdl') 187 187 188 188 def __init__(self, config=None, auth=None): … … 243 243 "synch_store") 244 244 self.store_url = config.get("experiment_control", "store_url") 245 self.splitter_url = config.get("experiment_control", " splitter_uri")245 self.splitter_url = config.get("experiment_control", "ns2topdl_uri") 246 246 self.fedkit = parse_tarfile_list(\ 247 247 config.get("experiment_control", "fedkit")) … … 268 268 self.state_lock = Lock() 269 269 self.tclsh = "/usr/local/bin/otclsh" 270 self.tcl_splitter = config.get(" splitter", "tcl_splitter") or \270 self.tcl_splitter = config.get("ns2topdl", "tcl_splitter") or \ 271 271 config.get("experiment_control", "tcl_splitter", 272 272 "/usr/testbed/lib/ns2ir/parse.tcl") … … 797 797 # Tweak search order so that if there are entries in access_user that 798 798 # have a project matching the export project, we try them first 799 if export_project and export_project.has_key('localname'):800 pn = export_project['localname']801 802 access_sequence = [ (p, u) for p, u in access_user if p == pn]803 access_sequence.extend([(p, u) for p, u in access_user if p != pn])799 if export_project: 800 access_sequence = [ (p, u) for p, u in access_user \ 801 if p == export_project] 802 access_sequence.extend([(p, u) for p, u in access_user \ 803 if p != export_project]) 804 804 else: 805 805 access_sequence = access_user … … 825 825 } 826 826 827 # If there is a master, and this is it, ask it to export services 828 # XXX move this to export pseudo-service 827 829 if tb == master: 828 # NB, the export_project parameter is a dict that includes829 # the type830 req['exportProject'] = export_project831 830 req['service'] = [ 832 831 { 'name': 'userconfig', 'visibility': 'export'}, … … 922 921 # better error coding 923 922 924 def remote_ splitter(self, uri, desc, master):923 def remote_ns2topdl(self, uri, desc): 925 924 926 925 req = { 927 926 'description' : { 'ns2description': desc }, 928 'master': master,929 'include_fedkit': bool(self.fedkit),930 'include_gatewaykit': bool(self.gatewaykit)931 927 } 932 928 933 r = self.call_Ns2 Split(uri, req, self.cert_file, self.cert_pwd,929 r = self.call_Ns2Topdl(uri, req, self.cert_file, self.cert_pwd, 934 930 self.trusted_certs) 935 931 936 if r.has_key('Ns2 SplitResponseBody'):937 r = r['Ns2 SplitResponseBody']932 if r.has_key('Ns2TopdlResponseBody'): 933 r = r['Ns2TopdlResponseBody'] 938 934 ed = r.get('experimentdescription', None) 939 935 if ed.has_key('topdldescription'): … … 2007 2003 return rv 2008 2004 2005 def get_master_project(self, req): 2006 master= None 2007 export_project = None 2008 for e in [ s for s in req.get('service', []) \ 2009 if s.get('name') == 'project_export']: 2010 for a in e.get('fedAttr', []): 2011 attr = a.get('attribute', None) 2012 if attr == 'testbed': 2013 master = a.get('value', None) 2014 elif attr == 'project': 2015 export_project = a.get('value', None) 2016 2017 return (master, export_project) 2018 2019 2009 2020 2010 2021 def create_experiment(self, req, fid): … … 2103 2114 raise service_error(service_error.server_config, 2104 2115 "Bad key type (%s)" % self.ssh_type) 2105 2106 master = req.get('master', None) 2116 master, export_project = self.get_master_project(req) 2117 # XXX get these out when master and project are optional 2107 2118 if not master: 2108 2119 raise service_error(service_error.req, 2109 2120 "No master testbed label") 2110 export_project = req.get('exportProject', None)2111 2121 if not export_project: 2112 2122 raise service_error(service_error.req, "No export project") 2113 2123 # XXX 2124 2114 2125 # Translate to topdl 2115 2126 if self.splitter_url: … … 2117 2128 self.log.debug("Calling remote splitter at %s" % \ 2118 2129 self.splitter_url) 2119 top = self.remote_splitter(self.splitter_url, 2120 file_content, master) 2130 top = self.remote_ns2topdl(self.splitter_url, file_content) 2121 2131 else: 2122 2132 tclcmd = [self.tclsh, self.tcl_splitter, '-t', '-x', -
fedd/federation/ns2topdl.py
r3e3a5de r5f6929a 20 20 fl.addHandler(nullHandler()) 21 21 22 class split_local:22 class ns2topdl_local: 23 23 def __init__(self, config=None, auth=None): 24 24 """ 25 25 Intialize the various attributes, most from the config object 26 26 """ 27 self.debug = config.getboolean(" splitter", "debug")28 self.muxmax = config.getint(" splitter", "muxmax", 3)29 self.tclsh = config.get(" splitter", "tclsh",27 self.debug = config.getboolean("ns2topdl", "debug") 28 self.muxmax = config.getint("ns2topdl", "muxmax", 3) 29 self.tclsh = config.get("ns2topdl", "tclsh", 30 30 "/usr/local/bin/otclsh") 31 self.tcl_splitter = config.get(" splitter", "tcl_splitter",31 self.tcl_splitter = config.get("ns2topdl", "tcl_splitter", 32 32 "/usr/testbed/lib/ns2ir/parse.tcl") 33 access_db = config.get(" splitter", "accessdb", None)34 allow_any = config.getboolean(" splitter", "allow_any", False)33 access_db = config.get("ns2topdl", "accessdb", None) 34 allow_any = config.getboolean("ns2topdl", "allow_any", False) 35 35 36 self.log = logging.getLogger("fedd. splitter")37 set_log_level(config, " splitter", self.log)36 self.log = logging.getLogger("fedd.ns2topdl") 37 set_log_level(config, "ns2topdl", self.log) 38 38 self.trace_file = sys.stderr 39 39 40 set_log_level(config, " splitter", self.log)40 set_log_level(config, "ns2topdl", self.log) 41 41 42 42 if auth: … … 44 44 else: 45 45 self.auth = authorizer() 46 self.log.warning("[ splitter] No authorizer passed in, " +\46 self.log.warning("[ns2topdl] No authorizer passed in, " +\ 47 47 "using local one") 48 48 … … 50 50 raise service_error(service_error.internal, 51 51 "Cannot specify both an access database and allow_any " +\ 52 "for splitter")52 "for ns2topdl") 53 53 54 54 if access_db: 55 55 try: 56 read_simple_accessdb(access_db, self.auth, ' split')56 read_simple_accessdb(access_db, self.auth, 'ns2topdl') 57 57 except IOError, e: 58 58 raise service_error(service_error.internal, … … 61 61 raise service_error(service_error.internal, "%s" % e) 62 62 elif allow_any: 63 auth.set_global_attribute(" split")63 auth.set_global_attribute("ns2topdl") 64 64 65 65 66 66 # Dispatch tables 67 67 self.soap_services = {\ 68 'Ns2 Split': soap_handler("Ns2Split", self.run_splitter),68 'Ns2Topdl': soap_handler("Ns2Topdl", self.run_ns2topdl), 69 69 } 70 70 71 71 self.xmlrpc_services = {\ 72 'Ns2 Split': xmlrpc_handler('Ns2Split', self.run_splitter),72 'Ns2Topdl': xmlrpc_handler('Ns2Topdl', self.run_ns2topdl), 73 73 } 74 74 75 def run_ splitter(self, req, fid):75 def run_ns2topdl(self, req, fid): 76 76 """ 77 The external interface to experiment creation called from the 78 dispatcher. 77 The external interface to tcl to topdl translation. 79 78 80 Creates a working directory, splits the incoming description using the 81 splitter script and parses out the avrious subsections using the 82 lcasses above. Once each sub-experiment is created, use pooled threads 83 to instantiate them and start it all up. 79 Creates a working directory, translates the incoming description using 80 the tcl script. 84 81 """ 85 82 86 if not self.auth.check_attribute(fid, ' split'):83 if not self.auth.check_attribute(fid, 'ns2topdl'): 87 84 raise service_error(service_error.access, "Access Denied") 88 85 89 86 try: 90 tmpdir = tempfile.mkdtemp(prefix=" split-")87 tmpdir = tempfile.mkdtemp(prefix="ns2topdl-") 91 88 except IOError: 92 89 raise service_error(service_error.internal, "Cannot create tmp dir") … … 96 93 gid = "dummy" 97 94 eid = "dummy" 95 master = "dummy" 98 96 99 req = req.get('Ns2 SplitRequestBody', None)97 req = req.get('Ns2TopdlRequestBody', None) 100 98 if not req: 101 99 raise service_error(service_error.req, 102 "Bad request format (no Ns2 SplitRequestBody)")100 "Bad request format (no Ns2TopdlRequestBody)") 103 101 # The tcl parser needs to read a file so put the content into that file 104 102 descr=req.get('description', None) … … 119 117 raise service_error(service_error.req, "No description") 120 118 121 master = req.get('master', None)122 if master == None:123 raise service_error(service_error.req, "No master testbed label")124 125 include_fedkit = req.get('include_fedkit', None)126 if include_fedkit == None:127 raise service_error(service_error.req,128 "No federation kit inclusion directive")129 130 119 131 120 tclcmd = [self.tclsh, self.tcl_splitter, '-t', '-x', 132 121 str(self.muxmax), '-m', master] 133 if include_fedkit: tclcmd.append('-k')134 122 tclcmd.extend([pid, gid, eid, tclfile]) 135 123 self.log.debug("Calling splitter %s" % " ".join(tclcmd)) -
wsdl/fedd_internal.wsdl
r3e3a5de r5f6929a 46 46 </message> 47 47 48 <message name="Ns2 SplitRequestMessage">49 <part name="Ns2 SplitRequestBody" type="xsd1:ns2SplitRequestType"/>50 </message> 51 52 <message name="Ns2 SplitResponseMessage">53 <part name="Ns2 SplitResponseBody" type="xsd1:ns2SplitResponseType"/>48 <message name="Ns2TopdlRequestMessage"> 49 <part name="Ns2TopdlRequestBody" type="xsd1:ns2TopdlRequestType"/> 50 </message> 51 52 <message name="Ns2TopdlResponseMessage"> 53 <part name="Ns2TopdlResponseBody" type="xsd1:ns2TopdlResponseType"/> 54 54 </message> 55 55 … … 86 86 <fault name="ReleaseFault" message="tns:FaultMessage"/> 87 87 </operation> 88 <operation name="Ns2 Split">88 <operation name="Ns2Topdl"> 89 89 <documentation> 90 90 This allows a fedd that does not have direct access to the modified ns … … 92 92 that functionality remotely. 93 93 </documentation> 94 <input message="tns:Ns2 SplitRequestMessage"/>95 <output message="tns:Ns2 SplitResponseMessage"/>96 <fault name="Ns2 SplitFault" message="tns:FaultMessage"/>94 <input message="tns:Ns2TopdlRequestMessage"/> 95 <output message="tns:Ns2TopdlResponseMessage"/> 96 <fault name="Ns2TopdlFault" message="tns:FaultMessage"/> 97 97 </operation> 98 98 </portType> … … 169 169 </fault> 170 170 </operation> 171 <operation name="Ns2 Split">172 <documentation> 173 The bindings of this operation are straightforward SOAP RPC 1.1. 174 </documentation> 175 <soap:operation soapAction="Ns2 Split"/>176 <input> 177 <soap:body use="encoded" parts="tns:Ns2 SplitRequestBody"178 namespace="http://www.isi.edu/faber/fedd_internal.wsdl" 179 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 180 </input> 181 <output> 182 <soap:body use="encoded" parts="tns:Ns2 SplitResponseBody"183 namespace="http://www.isi.edu/faber/fedd_internal.wsdl" 184 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 185 </output> 186 <fault name="Ns2 SplitFault">187 <soap:fault use="encoded" name="tns:Ns2 SplitFault"171 <operation name="Ns2Topdl"> 172 <documentation> 173 The bindings of this operation are straightforward SOAP RPC 1.1. 174 </documentation> 175 <soap:operation soapAction="Ns2Topdl"/> 176 <input> 177 <soap:body use="encoded" parts="tns:Ns2TopdlRequestBody" 178 namespace="http://www.isi.edu/faber/fedd_internal.wsdl" 179 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 180 </input> 181 <output> 182 <soap:body use="encoded" parts="tns:Ns2TopdlResponseBody" 183 namespace="http://www.isi.edu/faber/fedd_internal.wsdl" 184 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 185 </output> 186 <fault name="Ns2TopdlFault"> 187 <soap:fault use="encoded" name="tns:Ns2TopdlFault" 188 188 namespace="http://www.isi.edu/faber/fedd_internal.wsdl" 189 189 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> -
wsdl/fedd_types.xsd
r3e3a5de r5f6929a 573 573 <xsd:element name="experimentdescription" 574 574 type="tns:experimentDescriptionType"/> 575 <xsd:element name="service" type="tns:serviceInfoType" minOccurs="0" 576 maxOccurs="unbounded" /> 575 577 <!-- begin deprecated --> 576 <xsd:element name="master" type="xsd:string" />577 <xsd:element name='exportProject' type="tns:IDType" />578 <xsd:element name="master" type="xsd:string" minOccurs="0" maxOccurs="1"/> 579 <xsd:element name='exportProject' type="tns:IDType" minOccurs="0" maxOccurs="1"/> 578 580 <!-- end deprecated --> 579 581 <xsd:element name="experimentID" type="tns:IDType"/> … … 824 826 </xsd:complexType> 825 827 826 <xsd:complexType name="ns2 SplitRequestType">827 <xsd:annotation> 828 <xsd:documentation> 829 Request to run the CEDL splitter remotely. This is primarily an830 internal interface.828 <xsd:complexType name="ns2TopdlRequestType"> 829 <xsd:annotation> 830 <xsd:documentation> 831 Request to run the CEDL to topdl translator remotely. This is 832 primarily an internal interface. 831 833 </xsd:documentation> 832 834 </xsd:annotation> 833 835 <xsd:sequence> 834 836 <xsd:element name="description" type="tns:experimentDescriptionType"/> 835 <xsd:element name="master" type="xsd:string"/> 836 <xsd:element name="include_fedkit" type="xsd:boolean"/> 837 <xsd:element name="include_gatewaykit" type="xsd:boolean"/> 838 </xsd:sequence> 839 </xsd:complexType> 840 841 <xsd:complexType name="ns2SplitResponseType"> 842 <xsd:annotation> 843 <xsd:documentation> 844 Remote splitter output. Also an internal interface 837 </xsd:sequence> 838 </xsd:complexType> 839 840 <xsd:complexType name="ns2TopdlResponseType"> 841 <xsd:annotation> 842 <xsd:documentation> 843 Translator splitter output. Also an internal interface 845 844 </xsd:documentation> 846 845 </xsd:annotation>
Note: See TracChangeset
for help on using the changeset viewer.