Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

device search layers not working as expected #624

Closed
inphobia opened this issue Jul 19, 2019 · 2 comments
Closed

device search layers not working as expected #624

inphobia opened this issue Jul 19, 2019 · 2 comments

Comments

@inphobia
Copy link
Member

Expected Behavior

i expect that selecting multiple options in the layers dropdown to return devices that match at least 1 of those layers.

this expection is inline with all other selection boxes (os versions, vendors, etc.). if for example you select multiple vendors you get all the devices that match any of those vendors, not ALL of them.

Current Behavior

selecting multiple layers will only return devices that have have all of the layers.

guess an easier way to explain:
all dropdown boxes seem to use OR as condition to select valid values
layers however seems to use AND instead.

to make matters ever more complicated, if you only select 1 layer (like layer 3), then the query will return all devices that have that layer present, regardless of which other layers it also claims to support.

Possible Solution

not sure if this is a bug or as designed, but at least to me it's confusing that layers haves different as the other selection operators.

Steps to Reproduce (for bugs)

i tested with 3 devices in the db:

  • 2 pseudodevices, which now provide layer3 (only)
  • 1 cisco sb, providing layer2 only
  1. to start, enter an asterix * in the "search anything" bar, then search for devices.
    the url string will be /search?tab=device&q=*&dns=&ip=&name=&location=&description=&matchall=on
  2. the web interface should return "No matching records." (strange, i thought globbing was supported)
  3. in the sidebar, select layer2 & search. the ciscosb device will be returned
    url: search?tab=device&q=*&dns=&ip=&name=&location=&description=&layers=2
  4. now select layer3, the 2 pseudodevices will be returned.
    url: search?tab=device&q=*&dns=&ip=&name=&location=&description=&layers=3
  5. now select both layer2+3, no devices will be returned
    url: search?tab=device&q=*&dns=&ip=&name=&location=&description=&layers=2&layers=3
  6. matchall on or off does not make a difference

to verify that only devices that match all selected layer options i also tested on another installation with 2000 or so devices. we have a few oneaccess routers in there which claim to do layers1/2/3/4/7 , a combination unique to them. searching with the following url:
search?tab=device&q=*&dns=&ip=&name=&location=&description=&layers=1&layers=2&layers=3&layers=4&layers=7&matchall=on
does indeed only return said oneaccess routers.

Context

Your Environment

  • Netdisco version used: HEAD
  • SNMP::Info version used: HEAD
@inphobia
Copy link
Member Author

kinda confusing i guess, so to summarize:

search type selection result
layer 3 all devices that report layer3, regardless of other layers
layer 2 all devices that report layer2, regardless of other layers
layer 2+3 all devices that report at least layers2+3
os ver 15.3(3)M3 only devices running 15.3(3)M3
os ver 15.3(3)M5 only devices running 15.3(3)M5
os ver 15.3(3)M3 + 15.3(3)M5 devices running either 15.3(3)M3 or 15.3(3)M5

i guess a point can be made that layers can't be compared to vendor names or os versions, since you can have multiple layers for a device but it can't have multiple vendors.

on the other hand there currently is no way to search for devices that only have 1 layer (like a pseudodev, which only reports layer3). searching for layer3 will return any device that has layer3 services.

i'm not sure if it's really worth the time, or if it's even wanted, to change this. seems someone spent quite some time in App::Netdisco::DB::ResultSet::Device to make it behave like it does. regretfully that it does, imo, the complete opposite of any other search option.

@ollyg
Copy link
Member

ollyg commented Aug 18, 2019

Thanks, fixed in [master 1b89d20] #624 device layers search should be OR (not AND)

@ollyg ollyg closed this as completed Aug 18, 2019
rc9000 added a commit to rc9000/netdisco that referenced this issue Aug 20, 2019
* upstream/master: (178 commits)
  fix for netdisco#633
  fix for netdisco#633
  fix for netdisco#633
  add relation to get latest node on port
  netdisco#624 device layers search should be OR (not AND)
  show how to package own radius dictionary files
  netdisco#630 display full oui vendor
  improvements to radius patch
  Modified to add Radius support (netdisco#621)
  typo
  typos
  typo
  typo
  typo
  typo
  typo
  typo
  typos
  typo
  typo
  Change Port Free icon to be more accessible (netdisco#633)
  you really need to install the packages we ask
  fix travis
  make sidebar tiny bit wider (netdisco#625)
  compare ieee mac against 6 iterations (netdisco#611)
  add poe on/off icons to legend
  handle row.power.power being NULL
  netdisco-docker triage
  typo
  if user installs Pg they should use supported version
  netdisco#610 better MAC addr input sanity checking
  a few more files to ignore (netdisco#609)
  fix pod
  fix pod as in b58a62
  fix pod as in b58a62
  fix pod formatting and typos
  fix pod formatting
  fix pod
  fix pod formatting
  fix pod formatting
  Properly escape angle brackets in C<>
  Fix device_auth formatting in POD
  yaml whitespace matters
  allow stats to run smoothly on ancient Pg 8.4
  release 2.042010
  netdisco#601 fix job queue no longer shows running or queued jobs
  Revert "fix netdisco#601"
  Revert "fix everything that does not use sidebar in web if"
  fix everything that does not use sidebar in web if
  fix netdisco#601
  release 2.042009
  netdisco#581 skip storing and displaying fabricated vlan 0
  perl 5.30 is released
  last pieces of b59043d / netdisco#590 (netdisco#600)
  netdisco#571 tests should not use user local config
  netdisco#589 only show link with highest agg speed if map links between two devices are asymmetric
  netdisco#586 do not show poller performance rows for still running jobs
  netdisco#584 fix for case where port has no corresponding properties row
  netdisco#577 fix bug related to hostnames comprised a-f only
  netdisco#585 make toastr notifications less annoying
  netdisco#590 remove DBIx::Class::Schema::Loader remnants
  netdisco#594 add PK to device_port_log and other tidying
  netdisco#596 fix default value on actionset field
  dbic sync between actual db & our functions/docs (netdisco#595)
  device_auth
  device_auth
  device_auth usage
  device_auth config
  change to device_auth config
  ask for some device info
  html template fixups (netdisco#576)
  configuration has moved to the wiki (netdisco#574)
  allow setting some speudo device  info (netdisco#572)
  intellij support (netdisco#573)
  move testing targets to perl 5.10 and 5.28
  show some opensuse love
  release 2.042008
  minor amendments to previous commit
  improve check_acl performance for basic IP string compare
  release 2.042007
  netdisco#568 use different icon for WAPs from clients
  improve check_acl performance for basic IP string compare
  netdisco#565 fix netdisco-do when no device param needed
  spelling/wording
  wording
  Allow to pass multiple time the -d parameter to perform the discovery of many devices in one command call. (netdisco#564)
  release 2.042006
  do not show ignored dupe jobs in job queue
  fix inconsistency in titlebar global search when port is selected
  netdisco#549 redux - fix for changing pseudo device ports
  netdisco rancid updates (netdisco#558)
  release 2.042005
  fix strange interaction between CORE::sort and List::MoreUtils::uniq
  refactor to try device port vlan update again
  better var names and change logic to skip port
  better sql update, fixed worker return, better logic on vlans
  netdisco#528 record egress untagged vlans in device_port_vlan table
  netdisco#549 clean manual topology after device ports change
  netdisco#551 better error message for both device_auth and snmp_auth
  netdisco#552 device addresses report has broken column data
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants