@@ -483,6 +483,8 @@ async def create_party_reregistration(self, registration_id=None):
483483 Take the neccessary steps to re-register this client with the server.
484484 """
485485
486+ if registration_id is None :
487+ registration_id = self .registration_id
486488 await self .create_party_registration (ven_id = self .ven_id , registration_id = registration_id )
487489
488490 if not self .registration_id :
@@ -632,10 +634,15 @@ async def create_opt(self, opt_type, opt_reason, targets, vavailability=None, ev
632634 service = 'EiOpt'
633635 message = self ._create_message ('oadrCreateOpt' , ** payload )
634636 response_type , response_payload = await self ._perform_request (service , message )
637+ logger .info (response_type , response_payload )
635638
636639 if 'opt_id' in response_payload :
637640 # VTN acknowledged the opt message
641+ logging .info (f"VTN acknowledged the opt message with opt_id { response_payload ['opt_id' ]} " )
638642 return response_payload ['opt_id' ]
643+ else :
644+ logging .error (f"VTN did not acknowledge the opt message" )
645+ return False
639646
640647 # TODO: what to do if the VTN sends an error or does not acknowledge the opt?
641648
@@ -662,11 +669,16 @@ async def cancel_opt(self, opt_id):
662669 service = 'EiOpt'
663670 message = self ._create_message ('oadrCancelOpt' , ** payload )
664671 response_type , response_payload = await self ._perform_request (service , message )
672+ logger .info (response_type , response_payload )
665673
666674 if 'opt_id' in response_payload :
667675 # VTN acknowledged the opt cancelation
676+ logging .info (f"VTN acknowledged the opt cancelation with opt_id { response_payload ['opt_id' ]} " )
668677 self .opts .remove (opt )
669678 return True
679+ else :
680+ logging .error (f"VTN did not acknowledge the opt cancelation" )
681+ return False
670682
671683 ###########################################################################
672684 # #
@@ -799,13 +811,12 @@ async def create_report(self, response_payload):
799811 'granularity' : granularity ,
800812 'job' : job })
801813 else :
802- job = None
803814 self .report_requests .append ({'report_request_id' : report_request_id ,
804815 'report_specifier_id' : report_specifier_id ,
805816 'report_back_duration' : report_back_duration ,
806817 'r_ids' : requested_r_ids ,
807818 'granularity' : granularity ,
808- 'job' : job })
819+ 'job' : None })
809820
810821 async def report_callback ():
811822 await self .update_report (report_request_id )
@@ -823,7 +834,8 @@ async def report_callback():
823834 message = self ._create_message (message_type ,
824835 response = {'response_code' : response_code ,
825836 'response_description' : 'OK' if response_code == 200 else 'ERROR' ,
826- 'request_id' : response_payload ['request_id' ]},
837+ 'request_id' : response_payload ['request_id' ] if 'request_id' in response_payload else \
838+ response_payload ['response' ]['request_id' ]},
827839 ven_id = self .ven_id ,
828840 ** message_payload )
829841 await self ._perform_request (service , message )
@@ -1257,9 +1269,9 @@ async def _poll(self):
12571269 return
12581270
12591271 elif response_type == 'oadrRequestReregistration' :
1260- logger .info ("The VTN required us to re-register. Calling the registration procedure." )
1272+ logger .info ("The VTN required us to re-register. Calling the re- registration procedure." )
12611273 await self .send_response (service = 'EiRegisterParty' )
1262- await self .create_party_registration ()
1274+ await self .create_party_reregistration ()
12631275
12641276 elif response_type == 'oadrDistributeEvent' :
12651277 if 'events' in response_payload and len (response_payload ['events' ]) > 0 :
0 commit comments