gallak / fusiondirectory-plugins-netdisco

plugin netdisco for Fusiondirectory
GNU General Public License v2.0
4 stars 1 forks source link

rewrite switch drawing #8

Closed gallak closed 1 year ago

gallak commented 1 year ago

All fetched port aren't physical port, we need to filter only port with type ethernetCsmacd

On Avaya  positions are like this <switch>.<port>  (example : 2.34) so it was easy for me to build a graphical  view
On Dell ( rebranded cisco in fact), port are defined by Te<switchnumber>/<module number>/<port number>  (example : Te1/0/23)
ollyg commented 1 year ago

Hi @gallak

You can select type ethernetCsmacd from Netdisco database but it won't get all physical ports on all devices because some devices return empty type or other value for physical ports. In Netdisco we take the reverse approach to filter out things which are not physical then we are left with the best list.

In SQL this looks like: https://github.com/netdisco/netdisco/blob/master/lib/App/Netdisco/DB/Result/Virtual/DevicePortSpeed.pm#L17-L20

 WHERE port !~* 'vlan'
    AND (descr IS NULL OR descr !~* 'vlan')
    AND (type IS NULL OR type !~* '^(53|ieee8023adLag|propVirtual|l2vlan|l3ipvlan|135|136|137)\$')
    AND (is_master = 'false' OR slave_of IS NOT NULL)

which in pseudocode means:

ports where the name does not contain text "vlan"
and the port description is empty or does not contain text "vlan"
and the port type is empty or not any of these: (53|ieee8023adLag|propVirtual|l2vlan|l3ipvlan|135|136|137)
and the port is not link aggregate master or is a member of an aggregate set

I hope this helps!

gallak commented 1 year ago

Thanks Oliver, i'll make m'y code more flexible thanks to the regexp. New release soon,I need to rewrite some other part (I take care about the "card" level)

gallak commented 1 year ago

device filtering is now an option inside fusion (regexp on device type)