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
    • 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
    • YouTube Videos
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Agility
      • Learn more about 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)
      • Book your Agile Fundamentals training
      • Book you Kanban workshop
    • >> Go to DataMiner Docs
  • DevOps
    • About the DevOps Program
    • Sign up for the DevOps Program
    • DataMiner DevOps Support
    • Feature Suggestions
  • Downloads
  • Swag Shop
  • PARTNERS
    • Business Partners
    • Technology Partners
  • Contact
    • Sales, Training & Certification
    • DataMiner Support
    • Global Feedback Survey
  • >> Go to dataminer.services

CISCO Manager – IF Interval

Solved45 views8 hours ago
0
Stefan Schedletzky [DevOps Enabler]2.28K 13 hours ago 0 Comments

Hi Dojo,

what is the best way to fill in the IF Interval in table Detailed Interface Info for the whole table and probably over 200 switches. We just want to activate it on all ports.

Bert Vandenberghe [SLC] [DevOps Enabler] Selected answer as best 8 hours ago

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
0
Stefan Schedletzky [DevOps Enabler]2.28K Posted 8 hours ago 1 Comment

If someone is interested here is the solution via automation script:

using Skyline.DataMiner.Automation;

namespace CiscoIFInterval
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Net.ReportsAndDashboards;

/// <summary>
/// Represents a DataMiner Automation script.
/// </summary>
public class Script
{
/// <summary>
/// The script entry point.
/// </summary>
/// <param name="engine">Link with SLAutomation process.</param>
public void Run(IEngine engine)
{
try
{
engine.Timeout = TimeSpan.FromMinutes(90);
RunSafe(engine);
}
catch (ScriptAbortException)
{
// Catch normal abort exceptions (engine.ExitFail or engine.ExitSuccess)
throw; // Comment if it should be treated as a normal exit of the script.
}
catch (ScriptForceAbortException)
{
// Catch forced abort exceptions, caused via external maintenance messages.
throw;
}
catch (ScriptTimeoutException)
{
// Catch timeout exceptions for when a script has been running for too long.
throw;
}
catch (InteractiveUserDetachedException)
{
// Catch a user detaching from the interactive script by closing the window.
// Only applicable for interactive scripts, can be removed for non-interactive scripts.
throw;
}
catch (Exception e)
{
engine.ExitFail("Run|Something went wrong: " + e);
}
}

private void RunSafe(IEngine engine)
{
var start = DateTime.Now;       // (3) runtime measurement
int changedCount = 0;           // (1) count number of changed ports
int errorCount = 0;             // (2) count number of errors

Element[] elementsCISCO = engine.FindElementsByProtocol("CISCO Manager", "Production");
var activeElements = (elementsCISCO ?? Array.Empty<Element>())
.Where(x => x != null && x.IsActive)
.ToArray();

int total = activeElements.Length;
engine.GenerateInformation("START CISCO: " + total);

if (total == 0)
{
var durationEmpty = (DateTime.Now - start).TotalSeconds;
engine.GenerateInformation($"END CISCO (no active elements) – Duration: {durationEmpty:F1}s");
return;
}

int processed = 0;

foreach (Element e in activeElements)
{
processed++;
engine.GenerateInformation($"[{processed}/{total}] CISCO Switch: {e.ElementName}");

string[] displayKeys;
string[] primaryKeys;

try
{
displayKeys = e.GetTableDisplayKeys(11000);
primaryKeys = e.GetTablePrimaryKeys(11000);
}
catch (Exception ex)
{
errorCount++;
engine.GenerateInformation($"Error retrieving table keys for {e.ElementName}: {ex.Message}");
continue;
}

if (displayKeys == null || primaryKeys == null || displayKeys.Length == 0)
{
engine.GenerateInformation($"No rows found in table 11000 for {e.ElementName}");
continue;
}

// Map DisplayKey -> PrimaryKey
var keyMap = new Dictionary<string, string>(displayKeys.Length);
for (int idx = 0; idx < displayKeys.Length; idx++)
{
var dk = displayKeys[idx];
var pk = primaryKeys[idx];
if (!string.IsNullOrEmpty(dk) && !string.IsNullOrEmpty(pk))
keyMap[dk] = pk;
}

foreach (string displayKey in displayKeys)
{
if (string.IsNullOrEmpty(displayKey))
continue;

if (!keyMap.TryGetValue(displayKey, out var primaryKey) || string.IsNullOrEmpty(primaryKey))
{
engine.GenerateInformation($"WARN: No PrimaryKey found for '{displayKey}' @ {e.ElementName}");
continue;
}

try
{
var ifType = Convert.ToString(e.GetParameter(11203, displayKey)); // safe read using DisplayKey
if (ifType != "6")
continue; // only apply to ethernetCsmacd

var current = Convert.ToString(e.GetParameter(11274, displayKey)); // safe null/DBNull read

if (current != "5")
{
e.SetParameterByPrimaryKey(11274, primaryKey, 5.0);
changedCount++;
engine.GenerateInformation($"Set 11274=5.0 @ {e.ElementName}, Port '{primaryKey}' (DisplayKey='{displayKey}', previous='{current}')");

// small delay between sets to avoid device overload
System.Threading.Thread.Sleep(100);
}
}
catch (Exception ex)
{
errorCount++;
engine.GenerateInformation($"ERROR setting value @ {e.ElementName}, Row '{displayKey}' (PK='{primaryKey}'): {ex.Message}");
}
}

// optional: process only the first two switches for testing
if (processed >= 2)
break;
}

var duration = (DateTime.Now - start).TotalSeconds; // (3) runtime measurement
engine.GenerateInformation($"END CISCO – {changedCount} ports updated, {errorCount} errors, Duration: {duration:F1}s");
}
}
}

Bert Vandenberghe [SLC] [DevOps Enabler] Selected answer as best 8 hours ago
Bert Vandenberghe [SLC] [DevOps Enabler] commented 8 hours ago

Nice! I was also going to suggest automation for this use case. There is a 'multiple set' window available to set a certain parameter on multiple elements, but with a table you also need to specify the index, so you would need to do this multiple set for each available index… (more info on multiple set: https://docs.dataminer.services/dataminer/Operator_guide/Elements/Working_with_elements/Updating_elements.html#setting-a-parameter-value-in-multiple-elements)

You are viewing 1 out of 1 answers, click here to view all answers.
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

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