Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Blog
  • Questions
  • Learning
    • E-learning Courses
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Tutorials
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • DataMiner Insights
      • Security
      • Integration Studio
      • System Architecture
      • DataMiner Releases & Updates
      • DataMiner Apps
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
  • Downloads
  • More
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
      • General Inquiries
      • DataMiner DevOps Support
      • Commercial Requests
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

SRM – Example code create regular booking

Solved1.31K views19th October 2020SRM
2
Mieke Dryepondt [SLC] [DevOps Advocate]3.58K 19th October 2020 0 Comments

For an integration we need to create a regular booking via an automation script.

  • Is there a code example available or a template where we can start from?
  • Are there key items we need to keep in mind?
Mieke Dryepondt [SLC] [DevOps Advocate] Selected answer as best 19th October 2020

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
3
Jorge Dias [SLC] [DevOps Enabler]4.76K Posted 19th October 2020 2 Comments

If you are using SRM Standard solution you can create bookings using one of the two following ways:

  1. Use method BookingManager.TryCreateNewBooking(Engine engine, Booking bookingData, IEnumerable<Function> functions, IEnumerable<Event> events, IEnumerable<Property> properties, IEnumerable<Group> groups, out ReservationInstance reservationInstance); (documentation below). Here you can find the same information that you see when creating a booking using the wizard. So in argument 'bookingData', you define the information that you see in the first screen of the wizard, in the 'functions' you define your resources and profiles, those are mandatory. Then you can also define properties, events and groups, these are optional.

//
// Summary:
// Tries to create a new booking using SRM Standard solution.
//
// Parameters:
// engine:
// Link with Skyline DataMiner.
//
// bookingData:
// Booking data, description, times, etc. Mandatory.
//
// functions:
// Functions to include in the booking. Mandatory.
//
// events:
// If Skyline.DataMiner.Library.Solutions.SRM.BookingManager.CustomEvents is true,
// then the desired ones can be filled here. Optional.
//
// properties:
// If Skyline.DataMiner.Library.Solutions.SRM.BookingManager.CustomProperties is
// true, then the desired ones can be filled here. Optional.
//
// groups:
// If filtering is configured in the Service Definition, group filters can be filled
// here. Optional.
//
// reservationInstance:
// The created reservation;otherwise null.
//
// Returns:
// True if the booking was created;otherwise false.
public bool TryCreateNewBooking(Engine engine, Booking bookingData, IEnumerable<Function> functions, IEnumerable<Event> events, IEnumerable<Property> properties, IEnumerable<Group> groups, out ReservationInstance reservationInstance);

E.g.: Bellow an example, taken for one of your test scripts:

var start = DateTime.SpecifyKind(DateTime.Now.AddDays(1), DateTimeKind.Local);
var end = DateTime.SpecifyKind(start.AddHours(1), DateTimeKind.Local);

var functions = FunctionsFactory.GetSatelliteDownlink(
TestSystemIds.Resources.Satellite.EUTELSAT_10A,
TestSystemIds.Resources.Antenna.MGR_ANTENNA_01,
TestSystemIds.Resources.Demodulating.MGR_MDM6100_01,
TestSystemIds.Resources.Decoding.KFS_RX8200_01);

var bookingData = new Booking
{
Description = $"Booking_{DateTime.Now.ToString("dd_HH_mm_ss")}",
Recurrence = new Recurrence
{
StartDate = startTime,
EndDate = endTime
},
ServiceDefinition = TestSystemIds.ServiceDefinitions.SDMN_SAT_Satellite_Downlink.ToString(),
};

var success = this.bookingManager.TryCreateNewBooking(Engine, bookingData, functions, null, null, null, out  var reservation);

2. Use method BookingManager.TryCreateNewBooking(Engine engine, Model.DefineBooking.InputData inputData, out ReservationInstance reservationInstance); (documentation below). With this method you will make use of Service Profiles, so you just need define the booking basic information, like timing and naming, and the ServiceProfileInstance that you want to use.

//
// Summary:
// Tries to create a new booking using SRM Standard solution relying on Service
// Profile Data.
//
// Parameters:
// engine:
// Link with Skyline DataMiner.
//
// inputData:
// Input Data that describes the Service Profile Data to be used.
//
// reservationInstance:
// The created reservation;otherwise null.
//
// Returns:
// True if the booking was created;otherwise false.
public bool TryCreateNewBooking(Engine engine, Model.DefineBooking.InputData inputData, out ReservationInstance reservationInstance);

If you are not using the SRM Standard solution you will have to build a ReservationInstance object with all the necessary info and then use ResourceManagerHelper to save schedule your booking.

Mieke Dryepondt [SLC] [DevOps Advocate] Selected answer as best 19th October 2020
Mieke Dryepondt [SLC] [DevOps Advocate] commented 19th October 2020

Hi Jorge,
I forgot to mention we don’t have a service definition.
I guess we then don’t need to go via the standard solution.
Would you be able to pass me example how to use the ReservationInstance object?

Jorge Dias [SLC] [DevOps Enabler] commented 19th October 2020

Below you can find a very simple example, of a booking with 1 resource, and two events: one at start and another at end, but there are endless other options to fill.

var reservationInstance = new ReservationInstance(new TimeRangeUtc(DateTime.UtcNow.AddMinutes(1), DateTime.UtcNow.AddMinutes(2)))
{
Name = “BookingName”,
Status = ReservationStatus.Confirmed
};
var resourceUsage = new ServiceResourceUsageDefinition
{
GUID = resourceId, // Set the guid of the desired resource id
RequiredCapabilities = new List(), // Define here your required capabilities, if any
RequiredCapacities = new List(), // Define here your required capacities, if any
NodeConfiguration = new NodeConfiguration
{
ProfileInstanceID = profileInstanceId, // Id of the profile instance that you want to use, if any
ResourceID = resourceId, // Fill again with the desired resource id
OverrideParameters = new ProfileParameterEntry[0], // Define here the parameters that you want to apply in the resource, if any
FunctionID = resourceFunctionId // Id of the function used to create the resource
}
};

reservationInstance.ResourcesInReservationInstance.Add(resourceUsage);

reservationInstance.AddEvent(reservationInstance.Start, new ReservationEvent(“START”, “fill the necessary string to execute the desired script”));
reservationInstance.AddEvent(reservationInstance.End, new ReservationEvent(“END”, “fill the necessary string to execute the desired script”));

var resourceManagerHelper = new ResourceManagerHelper(engine.SendSLNetSingleResponseMessage);
resourceManagerHelper.AddOrUpdateReservationInstances(reservationInstance);

var traceData = resourceManagerHelper.GetTraceDataLastCall();

if (!traceData.HasSucceeded())
{
engine.GenerateInformation(traceData.ToString());
}

Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas

Recent questions

Web Applications exception in Cube due to invalid certificate 0 Answers | 0 Votes
Redundancy Groups and Alarming – Duplicate Alarms 0 Answers | 0 Votes
Correlation Engine: “Test rule” doesn’t result in a hit, despite functional rule 1 Answer | 3 Votes

Question Tags

adl2099 (115) alarm (62) Alarm Console (82) alarms (100) alarm template (83) Automation (223) automation scipt (111) Automation script (167) backup (71) Cassandra (180) Connector (109) Correlation (69) Correlation rule (52) Cube (151) Dashboard (194) Dashboards (188) database (83) DataMiner Cube (57) DIS (81) DMS (71) DOM (140) driver (65) DVE (56) Elastic (83) Elasticsearch (115) elements (80) Failover (104) GQI (159) HTTP (76) IDP (74) LCA (152) low code app (166) low code apps (93) lowcodeapps (75) MySQL (53) protocol (203) QAction (83) security (88) SNMP (86) SRM (337) table (54) trending (87) upgrade (62) Visio (539) Visual Overview (345)
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin