glpi-project / glpi-inventory-plugin

GLPI Inventory plugin
GNU Affero General Public License v3.0
46 stars 27 forks source link

Use IP range set on task for Device NetInventory #524

Closed eduardomozart closed 2 months ago

eduardomozart commented 4 months ago

Fix https://github.com/glpi-project/glpi-inventory-plugin/issues/523

eduardomozart commented 4 months ago

Hello guys, I did some changes on the script to handle cenarios where there's some sort of VIP (virtual IP, used for redundancy on network devices). On my infrastructure, we have an Aruba Instant Access Points (IAP) cluster (a virtual controller that handle all APs on our site), as you can see below, both devices contains "192.168.0.6", which is a VIP that I use to manage the IAP cluster (only one device assume this IP at the time, and if this AP is down, other devices assume this VIP, so the cluster management is always available), but each AP has it's own AP:

image image

So this virtual IP (192.168.0.6) is on the same range than my task (192.168.0.0/24), but it will be used only if there's no other unique IP available on the same network range.

trasher commented 3 months ago

This would need tests

trasher commented 3 months ago

Please fix CS

eduardomozart commented 3 months ago

This would need tests

I'll see what I can do.

Please fix CS

Which line(s)?

trasher commented 3 months ago

Please fix CS Which line(s)?

See GH actions output: https://github.com/glpi-project/glpi-inventory-plugin/actions/runs/9891523512/job/28031989775?pr=524

eduardomozart commented 3 months ago

Hello, I added the Unit Tests as requested by trasher but as cedric already approved those changes and the changes I made after his approval was minimal (only continued loop if IP wasn't unique instead of breaking it), I believe it should work as expected. The changes I made after cedric approval may not be needed (at least, for Aruba IAP cluster Virtual IPs) if #536 be investigated further, but maybe other systems of redundancy can also assign an VIP for more than one device, so this kind of check maybe useful to keep.