Hi, how do we automate the action of uploading an alarm and trend template .xml files into DataMiner via automation scripts? We need to repeat this process over and over again for about 10 protocols in a test procedure and it would greatly help to be able to automate this action.
Hi Bing,
You can use this snippet to upload an alarm template.
public static void InstallAlarmTemplate(string protocolName, string protocolVersion, string templateName, string protocolFileUri)
{
// install alarm template in one go
CreateProtocolFileMessage create_template = new CreateProtocolFileMessage(1 /*=IAF_TEMPLATE*/, File.ReadAllText(protocolFileUri))
{
Sa = new SA(new string[] { protocolName, protocolVersion, templateName }),
iInfo = 0
};
Engine.SLNet.SendMessage(create_template);
}
note: This is an internal call and we do not recommend using this, as it is not officially supported and we cannot guarantee that it will still work in the future. As a rule, you should avoid using SLNet calls, as these are subject to change without notice.
Hi, if the first parameter is 0 then it’s a protocol, to upload trend templates another message is used.
Hi Bing,
Maybe you can use the CreateAlarmTemplate method of our Web Service (v1), though you will need to convert your XML files into the appropriate parameters, and to code access credentials within the automation to communicate with the Web Services.
Hi Gelber, that is a valid alternative. I tried to look through the list of v1 WebServices – are you aware if there is an equivalent for trend template?
Hi Bing,
I'm just throwing out some rough ideas here. I used the Client Test Tool FollowEvent functionality when I uploaded an Alarm Template (xml) file in my local DataMiner, and I can see the command as follows:
Probably, you can use this command and create a script based on your requirement in the Automation Script.
Hope this helps.
Hi Bing,
A possible option is creating a dmapp package with the protocols including the templates (a protocol solution allows you to include templates).
Another possible option could be creating an dmapp package with all the alarm/trend templates in the companion file folder.
Hope it helps.
Since these are test templates, we have chosen the companion files path.
But there are additional steps to upload each template individually in DataMiner. This is a rather repetitive step when repeating tests. What I would like to do is automate the process of uploading template .xml files. Currently we have about 24 of them and counting.
Hi Debeuf, thanks for the code snippet. Regarding the first parameter to CreateProtocolFileMessage() is Alarm template represented by ‘1’ and Trend template represented by ‘0’?