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
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • 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
    • 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
    • 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
      • About the DevOps Program
      • DataMiner DevOps Support
  • Downloads
  • More
    • DataMiner Releases & Updates
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Code for SetResourceMessage request

Solved1.29K views12th July 2023Automation CSharp resources SRM
2
Ruben Vandepitte [SLC] [DevOps Advocate]2.32K 7th October 2022 0 Comments

Hi,

Does anyone have (example) code available to implement the SetResourceMessage SLNet call, to either create a new resource, or to update an existing one programmatically?

Thanks!

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 12th July 2023

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
2
Matthias Declerck [SLC] [DevOps Advocate]2.75K Posted 7th October 2022 0 Comments

Hi Ruben,

It is highly advised not to use the SRM request messages directly, but rather use the helpers, such as ResourceManagerHelper in SLNet. It does have the API calls to create or update a Resource.
Pseudo code example:

public void Run(Engine engine)
{
    var rmHelper = new ResourceManagerHelper(engine.SendSLNetSingleResponseMessage);
    var protocolFunctionHelper = new ProtocolFunctionHelper(engine.SendSLNetSingleResponseMessage);
    var profileHelper = new ProfileHelper(engine.SendSLNetSingleResponseMessage);

    var mainElement = engine.FindElement("IRD Main Decoder");
    var functionElement = engine.FindElement("IRD Satellite Decoder");
    FunctionDefinitionID functionID = new FunctionDefinitionID(Guid.Parse("9fca935f-2794-4d9c-aa30-016b73ab4544")); // function definition ID example
    SystemFunctionDefinition functionDefinition = protocolFunctionHelper.GetFunctionDefinition(functionID, searchSystemFunctionDefinition: false); // function definition example
    ResourcePool decoderPool = rmHelper.GetResourcePool(Guid.Parse("eb08eb7f-93bc-4b80-943a-f8055c772e10")); //Decoder pool example
    Parameter capacityParameter = profileHelper.ProfileParameters.Read(ParameterExposers.ID.Equal(Guid.Parse("4fa4d673-c5fd-4477-8551-078d4be09f9f"))).FirstOrDefault(); // Capacity parameter example
    Parameter capabilityParameter = profileHelper.ProfileParameters.Read(ParameterExposers.ID.Equal(Guid.Parse("30067237-ba12-4ad3-b2c4-2bda53d406c4"))).FirstOrDefault(); // Capability parameter example

    var tableParameter = 2000;  //linked table parameter
    List<FunctionEntryPoint> entryPoints = protocolFunctionHelper.GetFunctionEntryPoints(functionID.Id, functionElement.DmaId, functionElement.ElementId);
    FunctionEntryPoint entryData = entryPoints.FirstOrDefault(x => x.ParameterID == tableParameter && x.Data?.Length > 0);
    EntryPointData nextEntryData = entryData.Data.FirstOrDefault(x => x.Element == null); // next unused table entry

    var decodeFunctionResource = new Skyline.DataMiner.Net.ResourceManager.Objects.FunctionResource(mainElement.DmaId, mainElement.ElementId)
    {
        GUID = Guid.NewGuid(),
        Name = "IRD Decoder",
        PoolGUIDs = new List<Guid>() { decoderPool.GUID },
        FunctionGUID = functionDefinition.GUID,
        FunctionName = functionElement.Name,
        PK = nextEntryData.IndexValue,
        DmaID = functionElement.DmaId,
        ElementID = functionElement.ElementId,
        LinkerTableEntries = new Tuple<int, string>[0],
        MaxConcurrency = 100,
        Capacities = new List<Skyline.DataMiner.Net.SRM.Capacities.MultiResourceCapacity>()
        {
            new Skyline.DataMiner.Net.SRM.Capacities.MultiResourceCapacity()
            {
                CapacityProfileID = capacityParameter.ID,
                Value = new CapacityParameterValue(maxQuantity: 100)
            }
        },
        Capabilities = new List<Skyline.DataMiner.Net.SRM.Capabilities.ResourceCapability>()
        {
            new Skyline.DataMiner.Net.SRM.Capabilities.ResourceCapability()
            {
                CapabilityProfileID = capabilityParameter.ID,
                IsTimeDynamic = false,
                Value = new CapabilityParameterValue(minRange: 1, maxRange: 10),
            }
        },
        Properties = new List<ResourceManagerProperty>()
        {
            new ResourceManagerProperty(Name: "Satellite state", Value: "Down"),
            new ResourceManagerProperty(Name: "Fiber state", Value: "Running"),
        },
    };

    rmHelper.AddOrUpdateResources(new Skyline.DataMiner.Net.Messages.Resource[] { decodeFunctionResource });
}

Hope this helps you further

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 12th July 2023
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
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