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,
The DataMiner.System library exposes a method to add rows to tables via automation script. Below an example to add a row in a table:
// Get the an instance of the DataMiner System
IDms dms = engine.GetDms();
// Get elements from the DataMiner System
IDmsElement element = dms.GetElement("MyElement");
IDmsTable table = element.GetTable(2000);
// Define the row to be added
object[] row = new object[] {
"3", // Primary key
1,
50,
1,
50,
1
};
// Add the row to the table
table.AddRow(row);
The values defined in the row will change depending of the table that you are trying to update.
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.