BGIS Cormant DCIM

Important Updates in Cormant-CS 13.0: Essential Guide to Scripting and API Changes

With the release of Cormant-CS 13.0, we have optimized the scripting engine for better performance. This involves deprecating six scripting methods, primarily related to SNMP and component saving, in favor of newer, more efficient ones. To make this transition smooth, the release package includes updated versions of all pre-packaged scripts.

For any standard scripts you are using, you will need to copy over the new versions provided in the release. If you have customized existing scripts or created your own from scratch, they will require manual updates to use the new method names.

Our comprehensive Web Services Programming Guide, included in the release package, provides detailed instructions and examples to guide you through exactly what needs to be changed. Our Cormant Support Team is aware of these updates and can guide you through the process. They have created an instructional KB article that summarizes key information from the Developer Guide, highlighting changes to Cormant-CS 13 scripting methods, along with sample formats and recommendations.

Key Updates for Your Custom Scripts

To improve performance and efficiency, we’ve deprecated a couple of methods in our scripting engine. Here are the two main areas you’ll want to review in your custom scripts.

1. Streamlining Attribute Updates: SaveComponent is Deprecated

Previously, it was possible to update system attributes directly on the component model and save them to the database using the ComponentServices.SaveComponent call. The preferred method described below updates any type of standard attribute.

The Change: Your scripts should now use the TryUpdateComponentAttributeValue method exclusively. We have removed the need for any separate SaveComponent calls, as the new method handles the entire update process.

Why it’s better: This change streamlines your code, making it cleaner and more efficient by removing redundant steps. The new method ensures your attribute updates are handled in a single, reliable call.

Example:

Before:


// This script generate random power value and save the value
protected override string Run()
{
    // set the minimum and maximum random value to generate
    int min = 500;
    int max = 1200;
    double powerValue = 0.00d;
    Random random = new Random();
    powerValue = random.Next(min, max);  //generate and assign random value
    
    // Save the random power value to Power Actual attribute
    this.Component.PowerActual = powerValue;
    ComponentServices.SaveComponent(this.Component);
    
    return "";
}

After:


// The updated script is cleaner and more efficient
protected override string Run()
{
    // set the minimum and maximum random value to generate
    int min = 500;
    int max = 1200;
    double powerValue = 0.00d;
    Random random = new Random();
    powerValue = random.Next(min, max);  //generate and assign random value
    
    // Save the random power value to Power Actual attribute
    ComponentServices.TryUpdateComponentAttributeValue(this.Component, "Power Actual", powerValue.ToString(), "Administrator");
    
    return "";
}

2. Optimizing SNMP Calls with Asynchronous Methods

For scripts that query devices using SNMP, we have moved to asynchronous methods to prevent the engine from wasting resources while waiting for a device to respond. Updating your scripts to use these new methods will result in better performance.

  • Modify the script to use the method “RunAsync”; it must have the async keyword and its return type must be wrapped within a Task<>.
  • Use the “await” keyword when calling the new asynchronous SNMP methods.

Below are the updated Async SNMP methods:

Deprecated SnmpServices method Replacement SnmpServices method
GetSnmpPropertyValue GetSnmpScalarTabularValueAsync
GetSnmpPropertyValueAsync GetSnmpScalarTabularValueAsync
GetSnmpScalarTabularValue GetSnmpScalarTabularValueAsync
GetSnmpTabularCellValue GetSnmpTabularCellValueAsync
SetSnmpPropertyValue SetSnmpPropertyValueAsync

Example:

Before:


protected override string Run()
{
    string power = SnmpServices.GetSnmpScalarTabularValue("systemTotalPower");  // Old synchronous method
    ComponentServices.UpdateComponentAttributeValue(parent, "Rack Power Actual", power, "Administrator");
    return power;
}

After:


protected override async Task<string> RunAsync()  // Note the new signature
{
    string power = await SnmpServices.GetSnmpScalarTabularValueAsync("systemTotalPower");  // Note "await" and the new "Async" method
    ComponentServices.UpdateComponentAttributeValue(parent, "Rack Power Actual", power, "Administrator");
    return power;
}

Affected canned scripts to update:

Below is the list of the affected scripts. If you have not customized these scripts, you can overwrite and update the existing scripts using the scripts included in our release.

  • Compute Site Aggregates
  • Compute Aggregates One Level
  • Compute Rack Aggregates
  • Compute Row Aggregates
  • Count FMD Assets
  • Get Machine Name
  • Get Outlet Power, Voltage, Amps – Severtech POPS
  • Get PDU Humidity, Power and Temperature
  • Get Platform Information
  • Get Power Actual, Temperature1 & 2, Humidity 1 & 2 – ServerTech
  • Get System Uptime
  • Get TP Link Connected Macs and Packets
  • Run Turn Server Tech Outlet Off
  • Run Turn Server Tech Outlet On
  • Run Turn TP Link Port On Or Off

If you have customized scripts, run the TSQL query to obtain the list of scripts that need updating.


SELECT * FROM Script where
(
    Command LIKE '%.savecomponent(%'
    OR Command LIKE '%GetSnmpPropertyValue(%'
    OR Command LIKE '%GetSnmpPropertyValueAsync(%'
    OR Command LIKE '%GetSnmpScalarTabularValue(%'
    OR Command LIKE '%GetSnmpTabularCellValue(%'
    OR Command LIKE '%SetSnmpPropertyValue(%'
)

API Evolution: Planning Your Transition from SOAP to our Modern RESTful API

As part of our commitment to providing the most current and secure technology, Cormant-CS 13.0 introduces an important evolution in our API framework.

With this release, the legacy Web API (SOAP) is now officially deprecated, and some previously marked endpoints have been permanently removed. While the rest of the SOAP API remains functional for now, it will be fully retired in a future release.  Customers should plan their migration from the SOAP API to the more modern RESTful API in version 13.0.

This transition from a SOAP API DCIM framework to our modern RESTful API DCIM model is driven by our commitment to providing faster, more scalable, and more secure integrations. For any new projects requiring DCIM with Integration via API, the REST API is the recommended choice. For existing integrations, starting the migration process now will ensure a smooth transition and access to the latest capabilities.

We’re Here to Help!

We are confident these changes will provide a more powerful and efficient experience. For technical details, please refer to the following resources:

Have questions or need support with your scripts or API integrations? Our team is ready to assist you. Please don’t hesitate to reach out to your Cormant support representative.

For a Quick Overview, watch our short video below to get started with a visual walkthrough of these changes.

Discover more from BGIS Cormant DCIM

Subscribe now to keep reading and get access to the full archive.

Continue reading