Infoblox::DHCP::RangeTemplate - DHCP RangeTemplate object.
A DHCP range template works as a 'cookie cutter' and can be used to create real DHCP range object in a quick and consistent way. The DHCP range object created from a DHCP range template will inherit most properties defined in range template object. So, most of the DHCP range template properties are the same as the DHCP range object properties.
my $dhcp_range_template = Infoblox::DHCP::RangeTemplate->new(
name => $string, # Required number_of_addresses => $num, # Required offset => $num, # Required bootfile => $filename, # Optional / Default is undefined bootserver => $ipv4addr | $fqdn | undef, # Optional / Default is undefined comment => $string, # Optional / Default is undefined ddns_domainname => $string | undef, # Optional / Default is undefined ddns_generate_hostname => "true" | "false", # Optional / Default is undefined deny_all_clients => "true" | "false", # Optional / Default is "false" deny_bootp => "true" | "false" | undef, # Optional / Default is undefined enable_ddns => "true" | "false", # Optional / Default is undefined enable_known_clients_option => "true" | "false", # Optional / Default is "false" enable_unknown_clients_option => "true" | "false", # Optional / Default is "false" exclude => [$ExclusionRange1,$ExclusionRange2,...], # Optional / Default is empty extattrs => { $string => $extattr, ... }, # Optional / Default is undefined extensible_attributes => { $string => $string | $num, $string => [ $string | $num, ... ], ... } # Optional / Default is undefined failover_assoc => $string, # Optional / Default is undefined filters => [$MAC,$RelayAgent,$Option,...], # Optional / Default is undefined known_clients_option => "Allow" | "Deny", # Optional / Default is undefined lease_scavenge_time => $number, # Optional / Default is -1 member => $Member, # Optional / Default is undefined nextserver => $ipv4addr | $fqdn | undef, # Optional / Default is undefined options => [$Option1,$Option2,...], # Optional / Default is empty logic_filters => [ $filter_name | $filter_obj, ...], # Optional / Default is undefined override_logic_filters => "true' | 'false", # Optional / Default value is "false" override_ddns_domainname => "true" | "false", # Optional / Default value is "false" override_lease_scavenge_time => "true" | "false", # Optional / Default value is "false" override_update_dns_on_lease_renewal => "true" | "false", # Optional / Default value is "false" pxe_lease_time => $num, # Optional / Default is undefined range_high_water_mark => $num, # Optional / Default is 95 range_high_water_mark_reset => $num, # Optional / Default is 95 range_low_water_mark => $num, # Optional / Default is 0 range_low_water_mark_reset => $num, # Optional / Default is 0 recycle_leases => "true" | "false", # Optional / Default is undefined server_association_type => "NONE" | "MEMBER" | "FAILOVER" | "MS_SERVER" # Optional / Default is undefined unknown_clients_option => "Allow" | "Deny", # Optional / Default is undefined update_dns_on_lease_renewal => "true" | "false", # Optional / Default value is "false" );
You cannot set both extattrs and extensible_attributes attributes at the same time.
The following functions are available to be applied to a DHCP Range Template object.
Use this function to specify a range template at network template on the Infoblox appliance. See Infoblox::DHCP::NetworkTemplate->range_templates() for parameters and return values.
#Construct a range template object my $dhcp_range_template = Infoblox::DHCP::RangeTemplate->new( name => "custom_range_template", number_of_addresses => "10", offset => "10", );
my $template = Infoblox::DHCP::Template->new( name => "custom_range_template", );
#Configure range template in network template object my $responce = $network_template->range_templates([$template]);
This section describes all the methods in an Infoblox::Session module that can be applied to a DHCP range template object.
Use this method to add a DHCP range template object to the Infoblox appliance. See Infoblox::Session->add() for parameters and return values.
#Construct an object my $dhcp_range_template = Infoblox::DHCP::RangeTemplate->new( name => "custom_range_template", number_of_addresses => "10", offset => "10", bootfile => "bootfile1.com", bootserver => "someserver.com", comment => "add range", ddns_generate_hostname => "true", deny_all_clients => "true", deny_bootp => "true", enable_ddns => "true", exclude => [$exclusion_range_template], filters => [$filter], member => $memberdhcp, nextserver => "3.3.3.3", options => [$option1], pxe_lease_time => "3600", recycle_leases => "true", );
# Submit for addition my $response = $session->add( $dhcp_range_template );
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 range template object:
name - Optional. The name of the DHCP range template. extattrs - Optional. A hash reference containing extensible attributes. extensible_attributes - Optional. A hash reference containing extensible attributes. server_association_type - Optional. The server association type for the range.
my @retrieved_objs = $session->get( object => "Infoblox::DHCP::RangeTemplate", name => "custom_range_template" );
my @retrieved_objs = $session->get( object => "Infoblox::DHCP::RangeTemplate", extensible_attributes => { 'Site' => 'Santa Clara' } );
Use this method to retrieve all the matching objects from the Infoblox appliance. See Infoblox::Session->search() for parameters and return values.
Apply the following attributes to search for a specific DHCP Range Template object:
name - Optional. The name of the DHCP range template (regular expression). comment - Optional. The comment of the DHCP range template (regular expression). extattrs - Optional. A hash reference containing extensible attributes. extensible_attributes - Optional. A hash reference containing extensible attributes. server_association_type - Optional. The server association type for the range.
For more information about searching extensible attributes, see Infoblox::Grid::ExtensibleAttributeDef/Searching Extensible Attributes.
my @retrieved_objs = $session->search( object => "Infoblox::DHCP::RangeTemplate", name => "custom_range_template" comment => ".*", );
my @retrieved_objs = $session->search( object => "Infoblox::DHCP::RangeTemplate", extensible_attributes => { 'Site' => 'Santa Clara' } );
Use this method to modify a DHCP range template object in the Infoblox appliance. See Infoblox::Session->modify() for parameters and return values.
# Use method to modify the comment. $dhcp_range_template->comment("this is a modified comment"); # Submit modification my $response = $session->modify( $dhcp_range_template );
Use this method to remove a DHCP range template object from the Infoblox appliance. See Infoblox::Session->remove() for parameters and return values.
To remove a specific object, first use get()
or search()
to retrieve the specific DHCP range template object, and then submit this object for removal.
# Get the objects with the same name my @retrieved_objs = $session->get( object => "Infoblox::DHCP::RangeTemplate", name => "custom_range_template" );
# Find the desired object from the retrieved list. my $desired_dhcp_range_template = $retrieved_objs[0]; # Submit for removal my $response = $session->remove( $desired_dhcp_range_template );
This section describes all the methods that can be used to configure and retrieve the attribute values of a DHCP range template object.
Use this method to set or retrieve a bootfile name which is the name of the file the client must download.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
This option is overridden independently from Infoblox::DHCP::RangeTemplate->bootserver() and Infoblox::DHCP::RangeTemplate->nextserver().
The boot file name in string format with a maximum of 256 bytes. The default value is undefined.
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 bootfile my $bootfile = $dhcp_range_template->bootfile(); #Modify bootfile $dhcp_range_template->bootfile("bootfile2.com"); #Un-override bootfile $dhcp_range_template->bootfile(undef);
Use this method to set or retrieve a bootserver name which is the name of the server where the boot file is stored.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
This option is overridden independently from Infoblox::DHCP::RangeTemplate->bootfile() and Infoblox::DHCP::RangeTemplate->nextserver().
The boot server IP address or name in FQDN (Fully Qualified Domain Name) format. The FQDN consists of the host name followed by the domain name (example: abc.com). A boot server name can have a maximum of 256 bytes. The default value is undefined.
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 bootserver my $bootserver = $dhcp_range_template->bootserver(); #Modify bootserver $dhcp_range_template->bootserver("anotherserver.com"); #Un-override bootserver $dhcp_range_template->bootserver(undef);
Use this method to set or retrieve a descriptive comment of a DHCP range template.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
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 comment my $comment = $dhcp_range_template->comment(); #Modify comment $dhcp_range_template->comment("Modifying the DHCP range template comment");
Use this method to set or retrieve the ddns_domainname value of a DHCP Range template object.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Setting this method to a defined value implicitly sets the override_ddns_domainname method to "true". Setting the parameter to undefined causes the appliance to use the Grid default and automatically resets the override_ddns_domainname attribute to "false".
Note that when ddns_domainname is set to a defined value and override_dddns_domainname is set to "false", the last operation takes precedence. Thus the sequence $object->ddns_domainname("testdomain"); $object->override_ddns_domainname("false"); will set override_ddns_domainname to "false", and the sequence $object->override_ddns_domainname("false"); $object->ddns_domainname("testdomain"); will result in override_ddns_domainname="true".
The dynamic DNS domain name 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 ddns_domainname my $ddns_domainname = $dhcp_range_template->ddns_domainname(); #Modify ddns_domainname $dhcp_range_template->ddns_domainname("test_domain.com");
Use this method to set or retrieve the ddns_generate_hostname flag of a DHCP range template.
Enable this method to allow only the DHCP server to generate a hostname.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the ddns_generate_hostname flag or "false" to deactivate/unset it. The default value is undefined.
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 ddns_generate_hostname my $ddns_generate_hostname = $dhcp_range_template->ddns_generate_hostname(); #Modify ddns_generate_hostname $dhcp_range_template->ddns_generate_hostname("false");
Use this method to set or retrieve the deny_all_clients flag of a DHCP range template.
Enable this method to deny all lease requests for the DHCP range created from template.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the deny_all_clients flag or "false" to deactivate/unset it. The default value for this field 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 deny_all_clients my $deny_all_clients = $dhcp_range_template->deny_all_clients(); #Modify deny_all_clients $dhcp_range_template->deny_all_clients("false");
Use this method to set or retrieve the deny_bootp flag of a DHCP range template.
Enable this method to deny all BOOTP requests for DHCP range created from this template.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the deny_bootp flag or "false" to deactivate/unset it. The default value is false which indicates that this attribute inherit the upper-level setting.
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 deny_bootp my $deny_bootp = $dhcp_range_template->deny_bootp(); #Modify deny_bootp $dhcp_range_template->deny_bootp("false");
Use this method to set or retrieve the enable_ddns flag of a DHCP range template.
Enable this method to allow dynamic DNS updates.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the enable_ddns flag or "false" to deactivate/unset it. The default value is undefined.
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 enable_ddns my $enable_ddns = $dhcp_range_template->enable_ddns(); #Modify enable_ddns $dhcp_range_template->enable_ddns("false");
Use this method to set or retrieve the enable_known_clients_option flag of a DHCP range.
You must set the enable_known_clients_option flag to true in order to use the known_clients_option attribute.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the enable_known_clients_option flag or "false" to deactivate/unset 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 enable_known_clients_option my $enable_known_clients_option = $dhcp_range->enable_known_clients_option(); #Modify enable_known_clients_option $dhcp_range->enable_known_clients_option("false");
Use this method to set or retrieve the enable_unknown_clients_option flag of a DHCP range.
You must set the enable_unknown_clients_option flag to true in order to use the unknown_clients_option attribute.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the enable_unknown_clients_option flag or "false" to deactivate/unset 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 enable_unknown_clients_option my $enable_unknown_clients_option = $dhcp_range->enable_unknown_clients_option(); #Modify enable_unknown_clients_option $dhcp_range->enable_unknown_clients_option("false");
Use this method to set or retrieve the exclusion range template in the DHCP range template.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid value is an array reference that contains defined Infoblox::DHCP::ExclusionRangeTemplate 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 exclude my $ref_exclude = $dhcp_range_template->exclude(); #Modify exclude $dhcp_range_template->exclude([$exl1]); #$exl1 is an Infoblox::DHCP::ExclusionRangeTemplate object
Use this method to set or retrieve the extensible attributes associated with a DHCP Range Template 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 = $dhcp_range_template->extattrs(); #Modify extattrs $dhcp_range_template->extattrs({ 'Site' => $extattr1, 'Administrator' => $extattr2 });
Use this method to set or retrieve the extensible attributes associated with a DHCP Range Template object.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
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 extensible attributes my $ref_extensible_attributes = $dhcp_range_template->extensible_attributes(); #Modify extensible attributes $dhcp_range_template->extensible_attributes({ 'Site' => 'Santa Clara', 'Administrator' => [ 'Peter', 'Tom' ] });
Use this method to set or retrieve the failover peer association name of the DHCP range template.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
If the attribute is set, the server_association_type attribute will also be set to "FAILOVER" if the name is defined, or to "NONE" if the member is also undefined.
Specify the failover peer association name in string format. The default value is undefined.
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 failover_assoc my $failover_assoc = $dhcp_range_template->failover_assoc(); #Modify failover_assoc $dhcp_range_template->failover_assoc("peer2");
Use this method to set or retrieve the filters of the DHCP range template.
Filters are used to screen the address assignments if the addresses in the DHCP range needs to be assigned to specific hosts.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The valid value is an array reference that contains defined Infoblox::DHCP::FilterRule::MAC, Infoblox::DHCP::FilterRule::NAC, Infoblox::DHCP::FilterRule::RelayAgent, Infoblox::DHCP::FilterRule::Fingerprint and Infoblox::DHCP::FilterRule::UserClass objects. The default value is undefined.
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 filters my $ref_filters = $dhcp_range_template->filters(); #Modify filters $dhcp_range_template->filters([$filter1]); #$filter1 is an Infoblox::DHCP::FilterRule::MAC, Infoblox::DHCP::FilterRule::MAC, Infoblox::DHCP::FilterRule::RelayAgent, Infoblox::DHCP::FilterRule::Fingerprint or Infoblox::DHCP::FilterRule::UserClass object.
Use this method to set or retrieve the known_clients_option option of a DHCP range.
Set this option to "Allow" or "Deny" to allow or prevent the allocation of an IP address from this pool to any client that has a host declaration.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "Allow" or "Deny" to set the known_clients_option flag value. The default value is undefined.
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 known_clients_option my $known_clients_option = $dhcp_range->known_clients_option(); #Modify known_clients_option $dhcp_range->known_clients_option("Deny");
Use this method to set or retrieve the lease_scavenge_time value of a DHCP Range Template object.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Setting this method to a defined value implicitly sets the override_lease_scavenge_time method to "true". Setting the parameter to undefined causes the appliance to use the default from the upper level and automatically resets the override_lease_scavenge_time attribute to "false".
Note that when lease_scavenge_time is set to a defined value and override_lease_scavenge_time is set to "false", the last operation takes precedence. Thus the sequence $object->lease_scavenge_time(604800); $object->override_lease_scavenge_time("false"); will set override_lease_scavenge_time to "false", and the sequence $object->override_lease_scavenge_time("false"); $object->lease_scavenge_time(604800); will result in override_lease_scavenge_time="true".
An integer that specifies the period of time, in seconds, that free and backup leases remain in the database before they are automatically deleted. To disable lease scavenging, set the parameter to -1. The minimum positive value must be greater than 86400 seconds (1 day). The default value of this parameter is -1, which means that lease scavenging is disabled.
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 lease_scavenge_time my $lease_scavenge = $dhcp_range_template->lease_scavenge_time(); #Modify lease_scavenge_time $dhcp_range_template->lease_scavenge_time(30 * 24 * 60 * 60);
Use this method to set or retrieve all the logic (ordered) filters associated with the DHCP Range Template object.
Filters are used to screen address assignments in a DHCP Range Template if the addresses are to be assigned to specific hosts.
Setting this method to a defined value implicitly sets the override_logic_filters method to "true". Setting the parameter to undefined causes the appliance to use the Grid default and automatically resets the override_logic_filters attribute to "false".
Note that when logic_filters is set to a defined value and override_dlogic_filters is set to "false", the last operation takes precedence. Thus the sequence $object->logic_filters($filters); $object->override_logic_filters("false"); will set override_logic_filters to "false", and the sequence $object->override_logic_filters("false"); $object->logic_filters($filters); will result in override_logic_filters="true".
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The valid value is an array reference that contains either the Infoblox::DHCP::Filter::MAC, Infoblox::DHCP::Filter::NAC, Infoblox::DHCP::Filter::Option objects or the names of the corresponding filters. The filters in the list must satisfy the following conditions:
The default value of the parameter is undefined.
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 logic_filters my $ref_logic_filters = $dhcp_range_template->logic_filters(); #Modify logic_filters $dhcp_range_template->logic_filters(["filter_1","filter_2",$exl1]); #$exl1 is an Infoblox::DHCP::Filter::MAC, Infoblox::DHCP::Filter::NAC or Infoblox::DHCP::Filter::Option object.
Use this method to set or retrieve the member or Microsoft (r) server of the DHCP range template.
The member or Microsoft server that serves DHCP for this IP address range template.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
If the attribute is set, the server_association_type attribute will also be set to "MEMBER" if you set the member to an Infoblox::DHCP::Member object, to "MS_SERVER" if you set the member to an Infoblox::DHCP::MSServer object, or to "NONE" if failover_assoc is also empty.
The valid value is a defined Infoblox::DHCP::Member or Infoblox::DHCP::MSServer object. The default value is undefined.
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 member my $ref_member = $dhcp_range_template->member(); #Modify member $dhcp_range_template->member($member1); #$member is an Infoblox::DHCP::Member object
Use this method to set or retrieve the description of the name of the DHCP range template.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Name of the fixed address in string format with a maximum of 64 bytes. The default value is undefined.
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 name my $name = $dhcp_range_template->name(); #Modify name $dhcp_range_template->name("custom_range_template");
Use this method to set or retrieve the nextserver IP address which is the boot file server where the boot file is stored.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
This option is overridden independently from Infoblox::DHCP::RangeTemplate->bootfile() and Infoblox::DHCP::RangeTemplate->bootserver().
The next server IP address or name in FQDN (Fully Qualified Domain Name) format. The FQDN consists of the host name followed by the domain name (example: abc.com). A next server name can have a maximum of 256 bytes. The default value is undefined.
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 nextserver my $nextserver = $dhcp_range_template->nextserver(); #Modify nextserver $dhcp_range_template->nextserver("4.4.4.4"); #Un-override nextserver $dhcp_range_template->nextserver(undef);
Use this method to set or retrieve the number of addresses in this DHCP range template
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The number of addresses in this DHCP range template.
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 number_of_addresses my $number_of_addresses = $dhcp_range_template-> number_of_addresses(); #Modify number_of_addresses $dhcp_range_template->number_of_addresses("10");
Use this method to set or retrieve the address offset of this DHCP range template.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The address offset of this DHCP range template. The offset is calculated from the start address of network template to which the DHCP range template is assigned to. For example, if offset is set to 10 and number_of_addresses is set to 100, and network is set to 10.0.0.0/8, then start address of DHCP range created from this range template will be 10.0.0.10 and end address will be 10.0.0.100.
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 offset my $offset = $dhcp_range_template->offset(); #Modify offset $dhcp_range_template->offset("10");
Use this method to set or retrieve the options of the DHCP range template.
DHCP options describe network configuration settings and various services available on the network.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid value is an array reference that contains defined Infoblox::DHCP::Option objects. The default value is empty.
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 options my $ref_options = $dhcp_range_template->options(); #Modify options $dhcp_range_template->options([$option12]); #$option12 is an Infoblox::DHCP::Option object
The override_ddns_domainname attribute controls whether the ddns_domainname value in the DHCP range template is used, instead of the Grid default.
The override_ddns_domainname attribute can be specified explicitly. It is also set implicitly when ddns_domainname is set to a defined value.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Set the parameter to "true" to override the grid-level setting for ddns_domainname. Set the parameter to "false" to inherit the grid-level setting for ddns_domainname.
The default value of this parameter 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.
#Getting override_ddns_domainname my $override_ddns_domainname=$dhcp_range_template->override_ddns_domainname( ); #Modifying override_ddns_domainname $dhcp_range_template->override_ddns_domainname("true");
The override_lease_scavenge_time attribute controls whether the lease_scavenge_time value in the DHCP range template is used, instead of the upper-level default.
The override_lease_scavenge_time attribute can be specified explicitly. It is also set implicitly when lease_scavenge_time is set to a defined value.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Set the parameter to "true" to override the upper-level setting for lease_scavenge_time. Set the parameter to "false" to inherit the setting for lease_scavenge_time from the upper level.
The default value of this parameter 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.
#Getting override_lease_scavenge_time my $override_lease_scavenge_time=$dhcp_range_template->override_lease_scavenge_time( ); #Modifying override_lease_scavenge_time $dhcp_range_template->override_lease_scavenge_time("true");
The override_logic_filters attribute controls whether the logic_filters value in the DHCP Range Template is used, instead of the Grid default.
The override_logic_filters attribute can be specified explicitly. It is also set implicitly when logic_filters is set to a defined value.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Set the parameter to "true" to override the Grid-level setting for logic_filters. Set the parameter to "false" to inherit the Grid-level setting for logic_filters.
The default value of this parameter 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.
#Getting override_logic_filters my $override_logic_filters=$dhcp_range_template->override_logic_filters( ); #Modifying override_logic_filters $dhcp_range_template->override_logic_filters("true");
The override_update_dns_on_lease_renewal attribute controls whether the update_dns_on_lease_renewal value in the DHCP range template is used, instead of the Grid default.
The override_update_dns_on_lease_renewal attribute can be specified explicitly. It is also set implicitly when update_dns_on_lease_renewal is set to a defined value.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Set the parameter to "true" to override the grid-level setting for update_dns_on_lease_renewal. Set the parameter to "false" to inherit the grid-level setting for update_dns_on_lease_renewal.
The default value of this parameter 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.
#Getting override_update_dns_on_lease_renewal my $override_update_dns_on_lease_renewal=$dhcp_range_template->override_update_dns_on_lease_renewal( ); #Modifying override_update_dns_on_lease_renewal $dhcp_range_template->override_update_dns_on_lease_renewal("true");
Use this method to set or retrieve the PXE lease time value of the DHCP range template.
The Preboot Execution Environment lease time value is used by some hosts to boot remotely from a server.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
A 32-bit integer (range from 0 to 4294967295) represents the duration in seconds that the record is cached. Zero indicates that the record should not be cached. The default value is undefined.
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 pxe_lease_time my $pxe_lease_time = $dhcp_range_template->pxe_lease_time(); #Modify pxe_lease_time $dhcp_range_template->pxe_lease_time("7200");
Use this method to set or retrieve the range_high_water_mark value. If the percentage of allocated addresses exceeds this value, an SNMP trap is sent, unless this is a range served by a Microsoft server.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
A number that specifies the percentage of allocated addresses. The range is from 1 to 100. The high watermark value must be greater than the low watermark value. The default value is 95.
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 range_high_water_mark my $dhcp_range_template_high_water_mark = $dhcp_range_template->range_high_water_mark(); #Modify range_high_water_mark $dhcp_range_template->range_high_water_mark(80);
Use this method to set or retrieve the range_high_water_mark_reset value. If the percentage of allocated addresses drops below this value, a corresponding SNMP trap is reset.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
A number that specifies the percentage of allocated addresses. The range is from 1 to 100. The high watermark reset value must be lower than the high watermark value. The default value is 95.
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 range_high_water_mark_reset my $dhcp_range_template_high_water_mark_reset = $dhcp_range_template->range_high_water_mark_reset(); #Modify range_high_water_mark_reset $dhcp_range_template->range_high_water_mark_reset(70);
Use this method to set or retrieve the range_low_water_mark value. If the percentage of allocated addresses drops below this watermark, an SNMP trap is sent, unless this is a range served by a Microsoft server.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
A number that specifies the percentage of allocated addresses. The range is from 1 to 100. The low watermark value must be lower than the high watermark value. The default low watermark value is 0.
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 range_low_water_mark my $dhcp_range_template_low_water_mark = $dhcp_range_template->range_low_water_mark(); #Modify range_low_water_mark $dhcp_range_template->range_low_water_mark(10);
Use this method to set or retrieve the range_low_water_mark_reset value. If the percentage of allocated addresses exceeds this value, a corresponding SNMP trap is reset.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
A number that specifies the percentage of allocated addresses. The range is from 1 to 100. The low watermark reset value must be higher than the low watermark value. The default low watermark reset number is 0.
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 range_low_water_mark_reset my $dhcp_range_template_low_water_mark_reset = $dhcp_range_template->range_low_water_mark_reset(); #Modify range_low_water_mark_reset $dhcp_range_template->range_low_water_mark_reset(10);
Use this method to set or retrieve the DHCP range template server association type.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The server_association_type attribute can be specified explicitly. It is also set implicitly when member or failover_assoc are set.
Valid values are "NONE", "FAILOVER", "MS_SERVER" and "MEMBER".
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 server_association_type my $server_association_type = $dhcp_range_template->server_association_type(); #Modify server_association_type $dhcp_range_template->server_association_type("MEMBER");
Use this method to set or retrieve the recycle_leases flag of the DHCP range template.
If the flag is enabled, the leases are kept in recycle bin until one week after expiration. When the flag is disabled, the leases are irrecoverably deleted.
Specify "true" to set the recycle_leases flag or "false" to deactivate/unset it. The default value is undefined.
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 recycle_leases my $recycle_leases = $dhcp_range_template->recycle_leases(); #Modify recycle_leases $dhcp_range_template->recycle_leases("false");
Use this method to set or retrieve the unknown_clients_option option of a DHCP range.
Set this option to "Allow" or "Deny" to allow or prevent the allocation of an IP address from this pool to any client that has no host declaration.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "Allow" or "Deny" to set the unknown_clients_option flag value. The default value is undefined.
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 unknown_clients_option my $unknown_clients_option = $dhcp_range->unknown_clients_option(); #Modify unknown_clients_option $dhcp_range->unknown_clients_option("Deny");
The update_dns_on_lease_renewal attribute controls whether the DHCP server updates DNS when a DHCP lease is renewed.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Setting this method to a defined value implicitly sets the override_update_dns_on_lease_renewal method to "true". Setting the parameter to undefined causes the appliance to use the Grid default and automatically resets the override_update_dns_on_lease_renewal attribute to "false".
Note that when update_dns_on_lease_renewal is set to a defined value and override_update_dns_on_lease_renewal is set to "false", the last operation takes precedence. Thus the sequence $object->update_dns_on_lease_renewal("true"); $object->override_update_dns_on_lease_renewal("false"); will set override_update_dns_on_lease_renewal to "false", and the sequence $object->override_update_dns_on_lease_renewal("false"); $object->update_dns_on_lease_renewal("true"); will result in override_update_dns_on_lease_renewal="true".
Specify "true" to set the update_dns_on_lease_renewal flag or "false" to deactivate/unset it.
The default value of this parameter 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 update_dns_on_lease_renewal my $update_dns_on_lease_renewal=$dhcp_range_template->update_dns_on_lease_renewal( ); #Modify update_dns_on_lease_renewal $dhcp_range_template->update_dns_on_lease_renewal("true");
The following sample code demonstrates the different functions that can be applied to a DHCP range template object such as add, modify, and remove. Also, this sample includes error handling for the operations.
#Preparation prior to a DHCP RangeTemplate object insertion
#PROGRAM STARTS: Include all the modules that will be used use strict; use Infoblox;
#Create a session to the Infoblox appliance my $host_ip = "192.168.1.2"; my $session = Infoblox::Session->new( master => $host_ip, #appliance host ip username => "admin", #appliance user login password => "infoblox" #appliance password ); unless ($session) { die("Construct session failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Session created successfully\n";
#Create a DHCP Member object my $memberdhcp = Infoblox::DHCP::Member->new( name => "infoblox.localdomain", ipv4addr => $host_ip ); unless($memberdhcp) { die("Construct member failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "DHCP Member object created successfully\n";
#Create the Mac Filter object my $mac_filter = Infoblox::DHCP::Filter::MAC->new( name => "filter1", comment => "5 minutes" );
unless($mac_filter) { die("Construct Mac Filter object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Mac Filter object created successfully\n";
#Add the Mac Filter object into the Infoblox appliance through a session $session->add($mac_filter) or die("Add Mac Filter object failed: ", $session->status_code() . ":" . $session->status_detail());
print "Mac Filter object added to Infoblox appliance successfully\n";
#Construct DHCP Mac Filter rule object my $filter = Infoblox::DHCP::FilterRule::MAC->new( filter_name => "filter1", permission => "grant" ); unless($filter){ die("Construct filter object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Filter object created successfully\n";
#Construct exclusion range template object my $exclusion_range_template = Infoblox::DHCP::ExclusionRangeTemplate->new( offset => "15", number_of_addresses => "5", comment => "Excluded range" ); unless($exclusion_range_template){ die("Construct exclusion range template object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Exclusion range template object created successfully\n";
#Create a DHCP RangeTemplate object
my $dhcp_range_template = Infoblox::DHCP::RangeTemplate->new( name => "custom_range_template", offset => "10", number_of_addresses => "10", bootfile => "bootfile1.com", bootserver => "someserver.com", comment => "add range", ddns_generate_hostname => "true", deny_all_clients => "true", deny_bootp => "true", enable_ddns => "true", exclude => [$exclusion_range_template], filters => [$filter], member => $memberdhcp, nextserver => "3.3.3.3", pxe_lease_time => "3600", recycle_leases => "true", ); unless($dhcp_range_template) { die("Construct DHCP RangeTemplate object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "DHCP RangeTemplate object created successfully\n";
#Add the DHCP RangeTemplate object into the Infoblox appliance through a session $session->add($dhcp_range_template) or die("Add DHCP RangeTemplate object failed: ", $session->status_code() . ":" . $session->status_detail());
print "DHCP RangeTemplate object added to the network successfully\n";
#Search a DHCP RangeTemplate
#Search a DHCP RangeTemplate through the session my @retrieved_objs = $session->search( object => "Infoblox::DHCP::RangeTemplate", name => "custom_range_template", ); my $object = $retrieved_objs[0]; unless ($object) { die("Search DHCP RangeTemplate failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Search DHCP RangeTemplate object found at least 1 matching entry\n";
#Get and modify a DHCP RangeTemplate
#Get a DHCP RangeTemplate through the session my @retrieved_objs = $session->get( object => "Infoblox::DHCP::RangeTemplate", name => "custom_range_template", ); my $object = $retrieved_objs[0]; unless ($object) { die("Get DHCP RangeTemplate failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Get DHCP RangeTemplate object found at least 1 matching entry\n";
#Modify one of the attributes of the specified DHCP RangeTemplate $object->comment("modified comment");
#Un-override bootfile $object->bootfile(undef);
#Un-override bootserver $object->bootserver(undef);
#Un-override nextserver $object->nextserver(undef);
#Apply the changes $session->modify($object) or die("Modify DHCP Range Template failed: ", $session->status_code() . ":" . $session->status_detail());
print "DHCP RangeTemplate object modified successfully \n";
#Remove a DHCP RangeTemplate
#Get a DHCP RangeTemplate through the session my @retrieved_objs = $session->get( object => "Infoblox::DHCP::RangeTemplate", name => "custom_range_template", );
my $object = $retrieved_objs[0]; unless ($object) { die("Get DHCP Range Template failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Get DHCP RangeTemplate object found at least 1 matching entry\n";
#submit the object for removal $session->remove($object) or die("Remove DHCP Range Template failed: ", $session->status_code() . ":" . $session->status_detail());
print "DHCP Range Template object removed successfully \n";
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session, Infoblox::DHCP::NetworkTemplate, Infoblox::DHCP::ExclusionRangeTemplate, Infoblox::DHCP::Template, Infoblox::DHCP::FilterRule::MAC, Infoblox::DHCP::FilterRule::NAC, Infoblox::DHCP::FilterRule::RelayAgent, Infoblox::DHCP::FilterRule::UserClass, Infoblox::DHCP::Member, Infoblox::DHCP::Option
Copyright (c) 2017 Infoblox Inc.