Infoblox::DHCP::Fingerprint - DHCP Fingerprint object.
DHCP Fingerprint object.
my $fingerprint = Infoblox::DHCP::Fingerprint->new( name => $string, # required device_class => $string, # required type => 'CUSTOM' | 'STANDARD', # optional, default is 'CUSTOM' comment => $string, # optional disable => 'true' | 'false', # optional, default is 'false' vendor_id => [$string1, $string2, ...], # optional option_sequence => [$string1, $string2, ...], # optional ipv6_option_sequence => [$string1, $string2, ...], # optional extattrs => { $string => $extattr, ... }, # optional / Default is undefined extensible_attributes => $extattrs, # optional );
You cannot set both extattrs and extensible_attributes attributes at the same time.
At least one of option_sequence, ipv6_option_sequence or vendor_id must be defined.
This section describes all the methods in an Infoblox::Session module that you can apply to DHCP Fingerprint objects.
Use this method to add an object to the Infoblox appliance if the type value is 'CUSTOM'. Otherwise this method is not supported. See Infoblox::Session->add() for parameters and return values.
#Construct an object my $fingerprint = Infoblox::DHCP::Fingerprint->new( name => 'Infoblox', device_class => 'Inc', option_sequence => ['1'], );
#Submit for addition my $response = $session->add( $fingerprint );
Use this method to retrieve all the matching objects from the Infoblox appliance. See Infoblox::Session->get() for parameters and return values.
Apply the following attributes to get a specific DHCP Fingerprint object:
name - Optional. The name of the DHPC Fingerprint object. device_class - Optional. The class of DHCP Fingerprint object. type - Optional. The type of DHCP Fingerprint object. comment - Optional. The comment. extattrs - Optional. A hash reference containing extensible attributes. extensible_attributes - Optional. A hash reference containing extensible attributes.
# Get DHCP Fingerprint object by name my @retrieved_objs = $session->get( object => 'Infoblox::DHCP::Fingerprint', name => 'Infoblox', );
# Get all base DHCP Fingerprint objects my @retrieved_objs = $session->get( object => 'Infoblox::DHCP::Fingerprint', type => 'STANDARD', );
Use this method to modify an object in the Infoblox appliance. See Infoblox::Session->modify() for parameters and return values.
# Modify comment $fingerprint->comment("This is modified object"); # Submit modification my $response = $session->modify( $fingerprint );
Use this method to remove an object from the Infoblox appliance if the type value is 'CUSTOM'. Otherwise this method is not supported. See Infoblox::Session->remove() for parameters and return values.
To remove a specific object, first use get()
or search()
to retrieve the specific object, and then submit this object for removal.
# Get the object by name my @retrieved_objs = $session->get( object => 'Infoblox::DHCP::Fingerprint', name => 'Infoblox', ); #Find the desired object from the retrieved list. my $desired_fingerprint = $retrieved_objs[0]; # Submit for removal my $response = $session->remove( $desired_fingerprint );
Use this method to search for DHCP Fingerprint objects in the Infoblox appliance. See Infoblox::Session->search() for parameters and return values.
Apply the following attributes to search for specific DHCP Fingerprint objects:
name - Optional. The name of the DHPC Fingerprint object (regular expression). device_class - Optional. The class of DHCP Fingerprint object (regular expression). type - Optional. The type of DHCP Fingerprint object. comment - Optional. The comment (regular expression). extattrs - Optional. A hash reference containing extensible attributes. extensible_attributes - Optional. A hash reference containing extensible attributes.
# Search DHCP Fingerprint object by name my @retrieved_objs = $session->search( object => 'Infoblox::DHCP::Fingerprint', name => 'Infoblox', );
# Search all base DHCP Fingerprint objects my @retrieved_objs = $session->search( object => 'Infoblox::DHCP::Fingerprint', type => 'STANDARD', );
This section describes all the methods that you can use to configure and retrieve the attribute values of DHCP Fingerprint objects.
Use this method to set or retrieve a descriptive comment.
Desired comment in string format with a maximum of 256 bytes.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get attribute value my $value = $fingerprint->comment(); #Modify attribute value $fingerprint->comment('new comment');
Use this method to set or retrieve a class of DHCP Fingerprint object.
The class in string format with a maximum of 256 bytes.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get attribute value my $value = $fingerprint->device_class(); #Modify attribute value $fingerprint->device_class('Infoblox Inc.');
Use this method to set or retrieve a name of DHCP Fingerprint object.
The name in string format with a maximum of 256 bytes.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get attribute value my $value = $fingerprint->name(); #Modify attribute value $fingerprint->name('custom fingerprint');
Use this method to enable or disable a DHCP Fingerprint object.
If a DHCP Fingerprint object is enabled, the option number sequence and vendor_ids for this operating system or device will be included in the list of fingerprints to match incoming lease requests.
Specify "true" to disable DHCP Fingerprint object or "false" to enable it. The default value is 'false'.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get attribute value my $value = $fingerprint->disable(); #Modify attribute value $fingerprint->disable('false');
Use this method to set or retrieve the extensible attributes associated with a DHCP Fingerprint object.
Valid value is a hash reference containing the names of extensible attributes and their associated values ( Infoblox::Grid::Extattr objects ).
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get extattrs my $ref_extattrs = $fingerprint->extattrs(); #Modify extattrs $fingerprint->extattrs({ 'Site' => $extattr1, 'Administrator' => $extattr2 });
Use this method to set or retrieve the extensible attributes associated with DHCP Fingerprint objects.
For valid values for extensible attributes, see Infoblox::Grid::ExtensibleAttributeDef/Extensible Attribute Values.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get attribute value my $value = $fingerprint->extensible_attributes(); #Modify attribute value $fingerprint->extensible_attributes({ 'Site' => 'Santa Clara', 'Administrator' => [ 'Peter', 'Tom' ] });
Use this method to set or retrieve a list (comma separated list) of IPv4 option number sequences of the device or operating system.
At least one of option_sequence, ipv6_option_sequence or vendor_id must be defined.
Reference to an array of IPv4 option number sequence (comma separated list) in string format.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get attribute value my $value = $fingerprint->option_sequence(); #Modify attribute value $fingerprint->option_sequence(['1,2,3']);
Use this method to set or retrieve a list (comma separated list) of IPv6 option number sequences of the device or operating system.
At least one of option_sequence, ipv6_option_sequence or vendor_id must be defined.
Reference to an array of IPv6 option number sequence (comma separated list) in string format.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get attribute value my $value = $fingerprint->ipv6_option_sequence(); #Modify attribute value $fingerprint->ipv6_option_sequence(['1,2,3']);
Use this method to set or retrieve the type of the DHCP Fingerprint object.
Valid value can be 'STANDARD' or 'CUSTOM'. Standard fingerprints are the fingerprints from fingerbank. Custom fingerprints are user defined fingerprints.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get attribute value my $value = $fingerprint->type(); #Modify attribute value $fingerprint->type('CUSTOM');
Use this method to set or retrieve a list of vendor IDs of the device or operating system.
At least one of option_sequence, ipv6_option_sequence or vendor_id must be defined.
Reference to an array of vendor ID in string format.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get attribute value my $value = $fingerprint->vendor_id(); #Modify attribute value $fingerprint->vendor_id(['3','4']);
The following sample code demonstrates the different functions that can be applied to an object such as add, get, modify, search and remove. This sample also includes error handling for the operations.
#Preparation prior to getting and modifying DHCP Fingerprint object
use strict; use Infoblox;
#refers to Infoblox Appliance IP address my $host_ip = "192.168.1.2";
#Create a session to the Infoblox appliance
my $session = Infoblox::Session->new( master => $host_ip, username => "admin", password => "infoblox" ); unless ($session) { die("Construct session failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Session created successfully\n";
#Create DHCP Fingerprint object
my $fingerprint = Infoblox::DHCP::Fingerprint->new( 'name' => 'Infoblox', 'device_class' => 'Inc', 'option_sequence' => ['1'], );
unless ($fingerprint) { die("Construct DHCP Fingerprint object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "DHCP Fingerprint object created successfully\n";
my $response = $session->add($fingerprint);
unless ($response) { die("Add DHCP Fingerprint object failed: ", $session->status_code() . ":" . $session->status_detail()); } print"DHCP Fingerprint object added successfully \n";
#Search for DHCP Fingerprint object
my @retrieved_objs = $session->search( object => 'Infoblox::DHCP::Fingerprint', name => 'Infoblox', );
$fingerprint = $retrieved_objs[0];
unless ($fingerprint) { die("Search DHCP Fingerprint object object failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Search DHCP Fingerprint object found at least 1 matching entry\n";
#Get and modify DHCP Fingerprint object
@retrieved_objs = $session->get( object => 'Infoblox::DHCP::Fingerprint', name => 'Infoblox', );
$fingerprint = $retrieved_objs[0];
unless ($fingerprint) { die("Get DHCP Fingerprint object failed: ", $session->status_code() . ":" . $session->status_detail()); } print"Get DHCP Fingerprint object successful \n";
$fingerprint->comment("This is modified object");
$session->modify($fingerprint) or die("Modify DHCP Fingerprint object failed", $session->status_code() . ":" . $session->status_detail()); print "DHCP Fingerprint object modified successfully \n";
#Remove DHCP Fingerprint object
@retrieved_objs = $session->get( object => 'Infoblox::DHCP::Fingerprint', name => 'Infoblox', );
$fingerprint = $retrieved_objs[0];
unless ($fingerprint) { die("Get DHCP Fingerprint object failed: ", $session->status_code() . ":" . $session->status_detail()); } print"Get DHCP Fingerprint object successful \n";
$session->remove( $fingerprint ) or die("Remove DHCP Fingerprint object failed", $session->status_code() . ":" . $session->status_detail()); print"DHCP Fingerprint object removed successfully \n";
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Copyright (c) 2017 Infoblox Inc.