Good afternoon,
Did I miss something or there isn't a way to add "device type" in the current available list? For example, we do have mouses, screens, projectors, ipads, external hard drives, etc…. The only way I see it is to alter the tables which is not that obvious.
Thx!
Yann
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There are actually two ways to extend the list of types: either by changing the values in the *enum* field or by altering the iTop data model a bit further to turn the "typology" into something editable in iTop.
I wrote a short document explaining the two approaches for "Network Devices types". WHich is quite similar to other devices.
I tried to follow your document using option 2 on a production database. So far all worked well, except now I have a id in the types colon, not a name. The field is not linked, how would I fix that?
When I edit the field, I see the value (e.g Firewall)? Did I miss something?
Once you've modified the definition of the "Network Device" PHP object in iTop, you have to run the following MySQL command to adjust the SQL schema:
ALTER TABLE `networkdevice` CHANGE `type` `type` INT(11) NULL;
This should wipe out the previous values for the 'type' of the existing objects since MySQL has no way to transform the enum into a foreign key. (And this is also why I don't recommend this on a production database).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What I did was, adding a temporary type_tmp coloum of type int and then ran the following queries (more or less)
INSERT INTO networkdevicetype SELECT DISTINCT type FROM networkdevice;
UPDATE networkdevice AS d SET d.type_tmp = (SELECT t.id FROM networkdevicetype AS t WHERE t.name = d.type);
And then I dropped the type coloum and renamed type_tmp to type. Which should work, if I understood it correctly.
When I now open a network device I get :
Name devicename
…
Typ 5
…
Where 5 is corresondening to UTM. When I modify the device I see a drop down list with UTM selected. It's this last irretating "bug" which I try to fix. (Appart from some permission problem, I haven't looked into yet.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This tells iTop how to retrieve the name of the 'type' foreign key. This will be automatic in the next release of iTop, but for time being you must declare an 'ExternalField' if you don't want to have a number displayed in the 'type' column, when displaying a list of Network Devices.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@ulmerspatz : Oops, our replies have crossed each other, I guess. No need to 'empty' the 'type' field if the values are Ok in MySQL.
Just add the extra 'ExternalField' to the definition of the NetworkDevice class, as explained in the second part of my answer, and iTop will do the proper JOIN in SQL to display the values correctly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you patch a live instance of iTop, there is no tool/UI to update the profiles, so you have to update the priv_urp_grant_actions records "manually".
However if you run the installation process (i.e. on a new instance), then the rights to create/edit/delete the new 'NetworkDeviceType' objects will be given to the profile 'Configuration Manager' since the class has (in its initial parameters) the category 'configmgmt'.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good afternoon,
Did I miss something or there isn't a way to add "device type" in the current available list? For example, we do have mouses, screens, projectors, ipads, external hard drives, etc…. The only way I see it is to alter the tables which is not that obvious.
Thx!
Yann
Hi Yann,
There are actually two ways to extend the list of types: either by changing the values in the *enum* field or by altering the iTop data model a bit further to turn the "typology" into something editable in iTop.
I wrote a short document explaining the two approaches for "Network Devices types". WHich is quite similar to other devices.
The document can be downloaded from here: http://www.combodo.com/IMG/pdf/iTop_Customization.pdf
Hope this helps
Hi,
I tried to follow your document using option 2 on a production database. So far all worked well, except now I have a id in the types colon, not a name. The field is not linked, how would I fix that?
When I edit the field, I see the value (e.g Firewall)? Did I miss something?
I also attached a patch to https://sourceforge.net/apps/trac/itop/ticket/342 for both options.
I think you missed one step of the customization.
In the file “model.itop-config-mgmt.php” in “modules/itop-config-mgmt-1.0.0”, don't forget to replace the line:
By:
Well, I did apply my own patch (https://sourceforge.net/apps/trac/itop/attachment/ticket/342/db-network-types.diff) to a clean module tree… I just checked, it is definetly cleanly applied and the patch has this line in it.
Once you've modified the definition of the "Network Device" PHP object in iTop, you have to run the following MySQL command to adjust the SQL schema:
This should wipe out the previous values for the 'type' of the existing objects since MySQL has no way to transform the enum into a foreign key. (And this is also why I don't recommend this on a production database).
What I did was, adding a temporary type_tmp coloum of type int and then ran the following queries (more or less)
And then I dropped the type coloum and renamed type_tmp to type. Which should work, if I understood it correctly.
When I now open a network device I get :
Name devicename
…
Typ 5
…
Where 5 is corresondening to UTM. When I modify the device I see a drop down list with UTM selected. It's this last irretating "bug" which I try to fix. (Appart from some permission problem, I haven't looked into yet.)
I think I got it:
1) make sure that the 'type' field is clean in MySQL:
2) add the following line after the definition of the 'type' field on the NetworkDevice class:
This tells iTop how to retrieve the name of the 'type' foreign key. This will be automatic in the next release of iTop, but for time being you must declare an 'ExternalField' if you don't want to have a number displayed in the 'type' column, when displaying a list of Network Devices.
@ulmerspatz : Oops, our replies have crossed each other, I guess. No need to 'empty' the 'type' field if the values are Ok in MySQL.
Just add the extra 'ExternalField' to the definition of the NetworkDevice class, as explained in the second part of my answer, and iTop will do the proper JOIN in SQL to display the values correctly.
2) was the missing part. It's now working.
I updated my patch but now I wonder how I add the permissions for NetworkDeviceType to the patch.
I managed to get it working adding the corresponding rows to priv_urp_grant_actions. But I want the patch to be complete so I wondered.
If you patch a live instance of iTop, there is no tool/UI to update the profiles, so you have to update the priv_urp_grant_actions records "manually".
However if you run the installation process (i.e. on a new instance), then the rights to create/edit/delete the new 'NetworkDeviceType' objects will be given to the profile 'Configuration Manager' since the class has (in its initial parameters) the category 'configmgmt'.