SpriteLink / NIPAP

Neat IP Address Planner - NIPAP is the best open source IPAM in the known universe, challenging classical IP address management (IPAM) systems in many areas.
https://spritelink.github.io/NIPAP/
MIT License
537 stars 132 forks source link

Smart search for VRF attribute of prefixes doesn't work #987

Open garberg opened 8 years ago

garberg commented 8 years ago

It's currently not possible to use the VRF attribute in a prefix smart search:

$ nipap a l vrf=123:456
Searching for prefixes in any VRF...
Traceback (most recent call last):
  File "./nipap", line 138, in <module>
    cmd.exe(cmd.arg, cmd.exe_options, args)
  File "/home/lukagarb/dev/NIPAP/nipap-cli/nipap_cli/nipap_cli.py", line 575, in list_prefix
    vrf_q)
  File "/home/lukagarb/dev/NIPAP/nipap-cli/nipap_cli/pynipap.py", line 1047, in smart_search
    raise _fault_to_exception(xml_fault)
nipap_cli.pynipap.NipapInputError: Search variable 'vrf' unknown

There is a vrf attribute defined in the prefix smart parser, but as the prefix attribute is called vrf_rt the search_prefix function raises an exception.

Using the string vrf to match against the VRF RT is pretty natural and what at least I'd expect (rather than using vrf_rt), so I guess it'd make sense to allow it and rewrite to vrf_rt when building the query dict.

plajjan commented 8 years ago

Should "vrf" match on vrf_rt OR vrf_name ? Both are unique identifiers, right?