Hi everyone,
i'am looling to mask an EPM object from a c# automation script similar to the UI option that masks the object so that all related alarms (including new ones from the object itself and the children) are masked. The idea is to provide the EPM object by its System Type and System Name, a duration and the masking option.
Can you help me with that ?
Thanks a lot!
Hi Alexandre,
Here's an automation script that should more or less do the job for you, hope this helps
using Skyline.DataMiner.Automation;
using System;
using Skyline.DataMiner.Net;
using Skyline.DataMiner.Net.Masking;
using Skyline.DataMiner.Net.Messages;
using Skyline.DataMiner.Net.CPE;
internal class Script
{
private Engine _engine;
private const string SCRIPT_NAME = "Mask EPM";
private String _systemType;
private String _systemName;
private bool _mask = true;
public void Run(Engine engine)
{
_engine = engine;
try
{
_systemType = _engine.GetScriptParam("System Type").Value;
_systemName = _engine.GetScriptParam("System Name").Value;
if (!bool.TryParse(_engine.GetScriptParam("Mask").Value, out _mask)
){
_engine.GenerateInformation($"'{SCRIPT_NAME}' - Could not parse mask bool from Parameters");
}
Masking.InitMasking(engine);
Masking.SetMaskedStateForEPM(engine.UserDisplayName, _mask,_systemType, _systemName);
}
catch (Exception e)
{
_engine.GenerateInformation($"'{SCRIPT_NAME}' - " + e.ToString());
}
}
}
public static class Masking
{
private static CPECollectorHelper _helper;
public static void InitMasking(Engine engine){
_helper= new CPECollectorHelper(Engine.SLNetRaw);
}
public static void SetMaskedStateForEPM(String user, bool mask, String systemType, String systemName)
{
_helper.MaskLinkedDMAObjectRefTreesThroughTopology(
new MaskInfo()
{
DoMask = mask,
MaskType = MaskType.UntilUnmask,
Reason = "masking test"
},
systemType,
systemName
);
}
}