glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
212 stars 51 forks source link

Improve Ubnt serial and SSID detection #657

Closed eduardomozart closed 2 months ago

eduardomozart commented 2 months ago

Show SSID names instead of radio ifname on GLPI UI and fix Serial getting on UniFi AP series.

eduardomozart commented 2 months ago

Hi @eduardomozart

thank you for the changes.

I still see few things to update.

So can you check my comments ? One is just a question you must clarify.

Also can you provide the snmpwalk I requested so I can include it in our private tests and validate this PR works as expected ?

Here's the snmpwalk output as you requested:

u6-lite.walk.txt

Some Radios will not be reported with their respective names (will still be shown as "raX" or "raiX") as there's some Radios which are used internally for Mesh and Discovery, so there's no SSID associated to them, but user created SSID will report their names as expected. There also seems that Ubiquiti reports those iftypes as 6 (Ethernet) on OID but I believe they should be iftype as 188 (Wifi) as Aruba AP reports them as such, but GLPI doesn't import those kind of interfaces by default (I'll open ) and not sure if it would be OK to replace the OID iftype of Ubiquiti devices, but it would provide more information that the sysadmin could provide related to those radios, like "Wifi protocol version" and "Wifi mode", and also associate a "Wifi network", but GLPI doesn't seem to support importing 188 "iftypes" by default, so on the near future when I start working on a similar patch for Aruba devices and already reported such bug on https://github.com/glpi-project/glpi/issues/16981

Edit: I was wrong about get*ByMibSupport calls: when they return empty, the existent Device value isn't replaced by empty ones. One example would be to edit getMacAddress sub and remove the ${device}->{MAC} and the device still would report MAC address as expected, so I refactor the code a little bit. Thanks for your suggestions, I'm learning a lot about Perl and code guidelines following your guidance, sorry for my mistakes as it's the first time I'm programming in Perl at all.

eduardomozart commented 2 months ago

I removed the whitespaces and replaced the default iftype so the Radio interfaces are reported as WiFi as discussed in https://github.com/glpi-project/glpi/issues/16981 so the sysadmin could provide related to those radios, like "Wifi protocol version" and "Wifi mode", and also associate a "Wifi network".

eduardomozart commented 2 months ago

Hi @eduardomozart

sorry, I missed few needed checks yesterday. Nothing really critical, but this is just to make your code perfect.

Another point, packaging building is failing and I've included fixes in develop branch. Can you rebase your branch to include that GH Actions fixes ?

Hello, I've applied your changes and tested them on production, they seem to be working fine. Also rebase my repo.