On a extension of the config_form of all device, I have a drop_sql method (that part works).
This field in the DB is populated automatically when my discovery process find a equipment. It's almost like automation, but using only CDP and SNMP call to gather all the info of the device, and I get the serial number and the device type.
But sometime, old switch, the OID dosen't exist or can't be read. So I'd like to offer the possibility to the user to fill the fields_host_edit with his own value; when he edit a device.
Is their a possibility to do that ?
here my fields_host_edit add on (partial code):
Code: Select all
$fields_host_edit3['extenddb_header'] = array(
'friendly_name' => __('Extend DB'),
'method' => 'spacer',
'collapsible' => 'true'
);
$fields_host_edit3['serial_no'] = array(
'method' => 'drop_sql',
'friendly_name' => 'Serial No',
'description' => 'Enter the serial number.',
'max_length' => 50,
'value' => '|arg1:serial_no|',
'sql' => 'SELECT id, serial_no AS name FROM plugin_extenddb_host_serial_no WHERE host_id="|arg1:id|"',
'default' => '',
);
$fields_host_edit3['model'] = array(
'friendly_name' => 'Model',
'description' => 'This is the model of equipement.',
'method' => 'drop_sql',
'max_length' => 50,
'value' => '|arg1:model|',
'sql' => 'SELECT id, model AS name FROM plugin_extenddb_host_model WHERE host_id="|arg1:id|"',
'default' => '',
);