Reply

Perl add host with mac and dhcp settings

Member
Posts: 2
3064     0

To ALL:

 

    I am trying to get the perl api working with infoblox and am having a heck of a time with the nested structure.  I have the following snippet of code working, I can add the host.

 

my $host = Infoblox:Smiley Very HappyNS::Host->new(
         name => "wls-cctest215-249.cc.buffalo.edu",
         comment => "added AP via perl script",
         disable => "false",
         ipv4addrs => ["10.3.215.249"],
);

 

my $response = $session->add( $host );

 

But I am trying to add a 'mac' and 'configure for dhcp' to $host..  I believe they have to be put in the ipv4addrs section but for the life of me can not get the syntax right to get it to work?

 

If have the same issue when I get a host, I can not figure out how to display the ipv4addr and configure for dhcp options.

 

 

Re: Perl add host with mac and dhcp settings

Adviser
Posts: 101
3065     0

In this case, your IP must be of type Infoblox:Smiley Very HappyHCP::FixedAddr.

Then it works.

 

 

	my $host_addr = Infoblox::DHCP::FixedAddr->new(
		mac => "cafedeadbe98",
		match_client => "MAC",
		configure_for_dhcp => "true",
		ipv4addr => "192.168.32.98",
	);
		
	my $host = Infoblox::DNS::Host->new(
		name => "test98.test.net",
		#aliases => ["one", "two"], 
		comment => "my comment", 
		disable => "false",
		#ipv4addrs => ["192.168.32.98"],
		ipv4addrs => [$host_addr],
		ttl => 3600,
	);

Re: Perl add host with mac and dhcp settings

Member
Posts: 2
3065     0

That worked perfectly, thanks for the help

Showing results for 
Search instead for 
Did you mean: 

Recommended for You