Hi,
I'm building an Automation script that gathers data from multiple Cisco D9800 elements and needs to populate a table in another DataMiner element.
I can successfully:
Element satInfo = engine.FindElement("Sat info 7");
string[] keys = satInfo.GetTablePrimaryKeys(3000);
Mostrar más líneas
and also read remote Cisco elements:
Element cisco = engine.FindElement(dmaId, elementId);
cisco.GetParameter(...);
cisco.GetTablePrimaryKeys(...);
The data collection logic is working correctly.
I also confirmed that writing a normal parameter works:
satInfo.SetParameter(
1000,
"Automation OK");
However, I cannot find a supported way to create/update rows in a DataMiner table from Automation.
I found the following methods on the Element object:
GetParameterByPrimaryKey
SetParameterByPrimaryKey
GetTablePrimaryKeys
GetTableDisplayKeys
GetTableKeyMappings
I tried:
satInfo.SetParameterByPrimaryKey(
1012,
"TEST_ROW",
"TEST VALUE");
and also:
satInfo.SetParameterByPrimaryKey(
1012,
existingPrimaryKey,
"TEST VALUE");
but both fail with:
Set Parameter Failed: 0x80004005
Mostrar más líneas
My goal is the equivalent of what a protocol QAction does with:
protocol.FillArray(
tablePid,
rows,
NotifyProtocol.SaveOption.Full);
Mostrar más líneas
Questions:
What is the supported way to create table rows from an Automation script?
What is the supported way to update existing rows from an Automation script?
Is there an Automation equivalent of FillArray()?
Should this be done through SLNet messages instead of the Element object API?
Any code sample would be greatly appreciated.
Thanks!
Hi Alex,
Have you tried using the DataMiner Class Library? It provides IDmsTable.AddRow() and IDmsTable.SetRow() methods that might be what you're looking for.
You could try installing the Skyline.DataMiner.Core.DataMinerSystem.Automation NuGet package and using something like:
<code><span class="line">IDms dms = engine.GetDms();</span>
<span class="line">IDmsElement element = dms.GetElement("Sat info 7");</span>
<span class="line">IDmsTable table = element.GetTable(3000);</span>
<span class="line">table.AddRow(new object[] { "PK_VALUE", "col1Value", "col2Value" }); // create</span>
<span class="line">table.SetRow("PK_VALUE", new object[] { "PK_VALUE", "newValue" }); // update</span></code>
Here's the documentation for reference: https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Core.DataMinerSystem.Common.IDmsTable.html
I haven't tested this myself, but it might be worth exploring. Hope it helps!
For clarification:
PID 1010 is the table.
PID 1011-1019 are table columns.
Should SetParameterByPrimaryKey() be called on the table PID or on the column PID?
Example:
SetParameterByPrimaryKey(1012, pk, value)
currently fails with 0x80004005.