opennetadmin / ona

OpenNetAdmin IP Address Management (IPAM) system
opennetadmin.com
GNU General Public License v2.0
141 stars 35 forks source link

Wildcard support #144

Open rouba002 opened 5 years ago

rouba002 commented 5 years ago

This is more of a feature request.

It would be handy for some cases to support wildcard searches. Using the SQL LIKE syntax ./dcm.pl -r vlan_campus_display campus='%East%'

As I went through the code it looks like adjustments are needed in 'ona/www/include/functions_db.inc.php, function db_get_record' but I am not really good at PHP to get this done, sorry.

mattpascoe commented 5 years ago

In general the system should support % and _ sql constructs.. however many of the dcm options such as this are specifically meant to operate on a single entry. I.e this could possibly return many vlan campus matches but the code does not support that as it is unable to determine the ONE match. There is of course more to it than that but simply put, to do a display like this you would need it to match a single entry.

Now I will mention that I have worked on a true rest api endpoint that would replace the dcm.pl construct and it is able to do what you are talking about. It is not yet fully released however. You can play with it here if you want tho it is not ready for real use: https://github.com/opennetadmin/ona-core