- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
API Search regex for integer extensible attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2020 08:01 AM
Hi guys,
i am trying to get a list of all networks that have VLAN ID to determine which VLAN ID would be next. However I am not able to build a valid regex with an integer.
A normal query for a VLAN gives me this output, so you can see the structure:
/wapi/v2.9.5/network?_return_fields=comment,network,extattrs&*VLAN%20ID=1
{ "Error": "AdmConProtoError: Unknown extensible attribute: VLAN ID>0", "code": "Client.Ibap.Proto", "text": "Unknown extensible attribute: VLAN ID>0" }
Re: API Search regex for integer extensible attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 05:39 AM
Hi,
2 years later i encountered the same issue. I could solve it via regex search, which is availble in API v2.12.1.
Using Ansible so the API Call is abstracted:
- name: get all networks with ea vlan ansible.builtin.set_fact: ib_networks_with_vlan_ea: "{{ lookup('infoblox.nios_modules.nios_lookup', 'network', filter={'*VLAN~': '[0-9]+'}, return_fields=['comment', 'network', 'extattrs'], provider=nios_provider, wantlist=True) }}"
/wapi/v2.12.1/network?_return_fields=comment,network,extattrs&*VLAN~=[0-9]+
not using regex (\d+) since it is not supported:
https://docs.infoblox.com/space/nios86/35886899/Supported+Expressions+for+Search+Parameters
Re: API Search regex for integer extensible attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 11:45 AM
Just had an similar issue, but I got it to work by using the >= operator
curl -n 'https://<redacted>/wapi/v2.11.5/network?_return_fields%2B=network,extattrs&network_view=default&*VLAN_ID>=0'
Re: API Search regex for integer extensible attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 07:28 AM
In terms of regex lookups with Ansible lookup plugin
add ~ suffix to the field while using filter:
- name: fetch networks by regex starting with 10.231 set_fact: networks: "{{ lookup('nios', 'network', filter={'network~': '10.231'}, return_fields=['network','ipv4addr'], provider=nios_provider) }}" - name: print out the networks debug: var: networks
https://infoblox-client.readthedocs.io/en/stable/readme.html#search-by-regular-expression