Changeset 058f58e for fedd/fedd_experiment_control.py
- Timestamp:
- Nov 20, 2008 7:14:58 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- cfabc40
- Parents:
- c922f23
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_experiment_control.py
rc922f23 r058f58e 145 145 self.pdata.terminate() 146 146 147 call_RequestAccess = service_caller('RequestAccess', 148 'getfeddPortType', feddServiceLocator, 149 RequestAccessRequestMessage, 'RequestAccessRequestBody') 150 151 call_ReleaseAccess = service_caller('ReleaseAccess', 152 'getfeddPortType', feddServiceLocator, 153 ReleaseAccessRequestMessage, 'ReleaseAccessRequestBody') 154 155 call_Ns2Split = service_caller('Ns2Split', 156 'getfeddInternalPortType', feddInternalServiceLocator, 157 Ns2SplitRequestMessage, 'Ns2SplitRequestBody') 158 147 159 def __init__(self, config=None): 148 160 """ … … 242 254 # Dispatch tables 243 255 self.soap_services = {\ 244 'Create': make_soap_handler(\256 'Create': soap_handler(\ 245 257 CreateRequestMessage.typecode, 246 258 getattr(self, "create_experiment"), 247 259 CreateResponseMessage, 248 260 "CreateResponseBody"), 249 'Vtopo': make_soap_handler(\261 'Vtopo': soap_handler(\ 250 262 VtopoRequestMessage.typecode, 251 263 getattr(self, "get_vtopo"), 252 264 VtopoResponseMessage, 253 265 "VtopoResponseBody"), 254 'Vis': make_soap_handler(\266 'Vis': soap_handler(\ 255 267 VisRequestMessage.typecode, 256 268 getattr(self, "get_vis"), 257 269 VisResponseMessage, 258 270 "VisResponseBody"), 259 'Info': make_soap_handler(\271 'Info': soap_handler(\ 260 272 InfoRequestMessage.typecode, 261 273 getattr(self, "get_info"), 262 274 InfoResponseMessage, 263 275 "InfoResponseBody"), 264 'Terminate': make_soap_handler(\276 'Terminate': soap_handler(\ 265 277 TerminateRequestMessage.typecode, 266 278 getattr(self, "terminate_experiment"), … … 270 282 271 283 self.xmlrpc_services = {\ 272 'Create': make_xmlrpc_handler(\284 'Create': xmlrpc_handler(\ 273 285 getattr(self, "create_experiment"), 274 286 "CreateResponseBody"), 275 'Vtopo': make_xmlrpc_handler(\287 'Vtopo': xmlrpc_handler(\ 276 288 getattr(self, "get_vtopo"), 277 289 "VtopoResponseBody"), 278 'Vis': make_xmlrpc_handler(\290 'Vis': xmlrpc_handler(\ 279 291 getattr(self, "get_vis"), 280 292 "VisResponseBody"), 281 'Info': make_xmlrpc_handler(\293 'Info': xmlrpc_handler(\ 282 294 getattr(self, "get_info"), 283 295 "InfoResponseBody"), 284 'Terminate': make_xmlrpc_handler(\296 'Terminate': xmlrpc_handler(\ 285 297 getattr(self, "terminate_experiment"), 286 298 "TerminateResponseBody"), … … 816 828 req['resources']['node'] = rnodes 817 829 818 # No retry loop here. Proxy servers must correctly authenticate 819 # themselves without help 820 821 try: 822 ctx = fedd_ssl_context(self.cert_file, 823 self.trusted_certs, password=self.cert_pwd) 824 except SSL.SSLError: 825 raise service_error(service_error.server_config, 826 "Server certificates misconfigured") 827 828 loc = feddServiceLocator(); 829 port = loc.getfeddPortType(uri, 830 transport=M2Crypto.httpslib.HTTPSConnection, 831 transdict={ 'ssl_context' : ctx }) 832 833 # Reconstruct the full request message 834 msg = RequestAccessRequestMessage() 835 msg.set_element_RequestAccessRequestBody( 836 pack_soap(msg, "RequestAccessRequestBody", req)) 837 838 try: 839 resp = port.RequestAccess(msg) 840 except ZSI.ParseException, e: 841 raise service_error(service_error.req, 842 "Bad format message (XMLRPC??): %s" % str(e)) 843 except ZSI.FaultException, e: 844 resp = e.fault.detail[0] 845 846 # Again, weird incompatibilities rear their head. userRoles, which are 847 # restricted strings, seem to be encoded by ZSI as non-unicode strings 848 # in a way that confuses the pickling and XMLRPC sending systems. 849 # Explicitly unicoding them seems to fix this, though it concerns me 850 # some. It may be that these things are actually a ZSI string 851 # subclass, and the character encoding is not the major issue. In any 852 # case, making all the subclasses of basestring into unicode strings 853 # unifies the response format and solves the problem. 854 r = make_unicode(fedids_to_obj(unpack_soap(resp))) 830 r = self.call_RequestAccess(uri, req, 831 self.cert_file, self.cert_pwd, self.trusted_certs) 855 832 856 833 if r.has_key('RequestAccessResponseBody'): 857 834 r = r['RequestAccessResponseBody'] 858 835 else: 859 raise service_error(service_error.pro xy,836 raise service_error(service_error.protocol, 860 837 "Bad proxy response") 861 838 … … 894 871 "Unknown testbed: %s" % tb) 895 872 896 # The basic request 897 req = { 'allocID' : aid } 898 899 # No retry loop here. Proxy servers must correctly authenticate 900 # themselves without help 901 try: 902 ctx = fedd_ssl_context(self.cert_file, 903 self.trusted_certs, password=self.cert_pwd) 904 except SSL.SSLError: 905 raise service_error(service_error.server_config, 906 "Server certificates misconfigured") 907 908 loc = feddServiceLocator(); 909 port = loc.getfeddPortType(uri, 910 transport=M2Crypto.httpslib.HTTPSConnection, 911 transdict={ 'ssl_context' : ctx }) 912 913 # Reconstruct the full request message 914 msg = ReleaseAccessRequestMessage() 915 msg.set_element_ReleaseAccessRequestBody( 916 pack_soap(msg, "ReleaseAccessRequestBody", req)) 917 918 try: 919 resp = port.ReleaseAccess(msg) 920 except ZSI.ParseException, e: 921 raise service_error(service_error.req, 922 "Bad format message (XMLRPC??): %s" % str(e)) 923 except ZSI.FaultException, e: 924 resp = e.fault.detail[0] 873 resp = self.call_ReleaseAccess(uri, {'allocID': aid}, 874 self.cert_file, self.cert_pwd, self.trusted_certs) 925 875 926 876 # better error coding … … 934 884 } 935 885 936 # No retry loop here. Proxy servers must correctly authenticate 937 # themselves without help 938 try: 939 ctx = fedd_ssl_context(self.cert_file, 940 self.trusted_certs, password=self.cert_pwd) 941 except SSL.SSLError: 942 raise service_error(service_error.server_config, 943 "Server certificates misconfigured") 944 945 loc = feddInternalServiceLocator(); 946 port = loc.getfeddInternalPortType(uri, 947 transport=M2Crypto.httpslib.HTTPSConnection, 948 transdict={ 'ssl_context' : ctx }) 949 950 # Reconstruct the full request message 951 msg = Ns2SplitRequestMessage() 952 msg.set_element_Ns2SplitRequestBody( 953 pack_soap(msg, "Ns2SplitRequestBody", req)) 954 955 try: 956 resp = port.Ns2Split(msg) 957 except ZSI.ParseException, e: 958 raise service_error(service_error.req, 959 "Bad format message (XMLRPC??): %s" % 960 str(e)) 961 r = unpack_soap(resp) 886 r = self.call_Ns2Split(uri, req, self.cert_file, self.cert_pwd, 887 self.trusted_certs) 888 962 889 if r.has_key('Ns2SplitResponseBody'): 963 890 r = r['Ns2SplitResponseBody'] … … 965 892 return r['output'].splitlines() 966 893 else: 967 raise service_error(service_error.pro xy,894 raise service_error(service_error.protocol, 968 895 "Bad splitter response (no output)") 969 896 else: 970 raise service_error(service_error.pro xy, "Bad splitter response")897 raise service_error(service_error.protocol, "Bad splitter response") 971 898 972 899 class current_testbed:
Note: See TracChangeset
for help on using the changeset viewer.