Infoblox API - limit scope of search?

Posts: 5
2144     0


I'm trying to query a large class B network for fixed address records. For example, network  but I want to limit the search to a single subnet, like subnet 2. How do I do this with the search API? This is what I have:


my @retrieved_objs = $session->search(
                        object => "Infoblox:Smiley Very HappyHCP::FixedAddr",
                        network => '',
                        network_view => "default",
                        return_methods => ['name','ipv4addr','mac']

unless (@retrieved_objs) {
                          die("Search records failed: ",
                          $session->status_code() . ":" . $session->status_detail());

my $count = 0;
foreach $entry (@retrieved_objs)
        $this_ip   = $entry->ipv4addr();
        $this_name = $entry->name();
        $this_ip   = $entry->ipv4addr();
        $this_mac  = $entry->mac();

        print "$this_name | $this_mac | $this_ip  \n";




This matches anything with 120.18.2  in it, so I get subnet 2, subnet 20, subnet 200 etc

How do I just get  ?



Re: Infoblox API - limit

Posts: 39
2144     0


I've noticed that the difference between the get and search methods is that search uses regex and get doesn't.

The dots in '' are treated as wildcards. use \. to escape the dots.

Because of its use of regex you can also leave out the final 0 in the network address.

Re: Infoblox API - limit

Posts: 5
2144     0

Thanks Stef ! I had not realised it was a regex. That makes sense now.

Much appreciated.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You