Hi Dojo,
I want to make use of reservations Event to trigger automation script at specific time.
I have following code:
First I define ReservationInstance, then I assign property to it(not relevant for the question) and finally I add 2 ReservationEvents to it. My expectation would be for TestEventScript to be triggered at predefined startTime and endTime, however that doesn't happen. I've also tried setting deprecated Time property to startTime and endTime with no luck.
Few other question come to mind:
- First parameter of AddEvent method is the key in the reservation json, which seems weird. Is that correct or am I doing something wrong?
- How can I pass parameters to the TestEventScript?
In this case TestEventScript is simple automation script that just logs one line and works fine when I execute it directly. I've tried to invoke automation script where Action is of type Script instead of C#, but again, with no luck.
I have been using DataMiner Objects Tool to inspect the new ReservationInstance and it looks okay to me:
I've tried looking at the documentation but, sadly, I wasn't able to find anything that could help me with this.
One more thing I've noticed is that Event class describes Script property to contain "script configuration string", so I'm thinking that maybe I need to pass specific format as second parameter in ReservationEvent constructor instead of simply providing the name.
Thanks,
Cheers
Hi Edib,
The second argument expects the same format as linking a visual shape to an Automation script.
string.Format("Script:{0}||Reservation ID={1};Action={2}|||NoConfirmation,NoSetCheck,Asynchronous", ActionScriptName, coreReservationId, action);
I tried guessing but it doesn't seem like a great approach. 😀
Hi Edib
Could you check SLResourceManagerAutomation logging if you see any errors at the time the event should trigger? You could also enable debug logging (level 5) to check if it triggered.
This one should work fine:
Script:TestEventScript||Reservation ID={reservationInstance.ID};Action=Execute|||Asynchronous
Documentation to add a custom event in the SRM Framework is available here: https://docs.dataminer.services/user-guide/Standard_Apps/SRM/srm_advanced_config/Service_Orchestration_advanced/Service_Orchestration_custom_events.html
You have on your script only Reservation ID and Action configured as script parameters? In case you have more, you also need to provide a value for it.
Hi,
The only thing visible in SLResourceManagerAutomation is the following line: “Done registering ReservationInstance. start task has id 2338 at 10/18/2024 15:01:45, end task has id 2341 at 10/18/2024 15:02:15” preceded by “registration” and “unregistration”, even when logging is set to DEVELOPMENT.
Regarding script parameters, my script doesn’t have any parameters, in which case I suppose “Script:TestEventScript” or “Script:TestEventScript|||||” or “Script:TestEventScript|||||” should work, but they don’t. Is there maybe some configuration that is required beforehand? I’ve also noticed that I can’t see the reservation in Order Booking Manager, not sure if that is expected because I assign no resources to the reservation.
Creating ReservationInstances without using the SRM framework are by default not visible in any booking manager. You can see those in the Bookings module in Cube or by using the Client Test Tool. Would it be possible to create first a booking without adding events and verify if you can see it being created?
It works, I’ve just been using DateTime.Now.AddSeconds(30) to set the time of Reservation expecting it to run in 30s, on the server that ended up meaning it will run in 2h and 30s. At least it clicked to me that reservations don’t need SRM and that SRM just leverages what is already there in the DataMiner, I’ll still call this productive. Thank you both for your help, cheers and enjoy your weekends!
Hi Jens,
I’ve added a new comment with screenshot of string formats I’ve tried, none of them work. Would you be able to assist me further?