Infoblox::DHCP::ExpandNetwork - Join or Expand an existing network
Expanding/Joining multiple networks into a larger network is the opposite of spliting a network. You can select a network and expand it into a larger network with smaller netmask.
#Constructor a DHCP Expand Network object my $expand_network = Infoblox::DHCP::ExpandNetwork->new ( network => $Network|$IPv6Network, #Required prefix => $num, #Required auto_create_reversezone => "true" | "false", #Optional / Default is "false" option_delete_ea => "RETAIN" | "REMOVE", #Optional / Default is "REMOVE" );
This section describes all the methods in Infoblox::Session that you can apply to a DHCP ExpandNetwork object.
Use this method to expand an existing network on the Infoblox appliance. See Infoblox::Session->add()
for parameters and return values
# construct the network to be expanded my $network = Infoblox::DHCP::Network->new( network => "123.0.0.0/16", );
# construct a Expand Network object my $expand_network = Infoblox::DHCP::ExpandNetwork->new ( network => $network, prefix => "13", auto_create_reversezone => "false" );
# Submit the Expand network operation. $session->add($expand_network);
This section describes all the methods that you can use to configure and retrieve the attribute value of a Expand Network.
Use this method to set the auto_create_reversezone flag. When set, this flag will automatically create reverse-mapping zones for the subnet.
Include the specified parameter to set the attribute value.
Specify "true" to set auto_create_reversezone 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.
#Set auto_create_reversezone $split_network->auto_create_reversezone("true");
Use this method to specify the network to be expanded.
Include the specified parameter to set the attribute value.
The valid values are either Infoblox::DHCP::Network or Infoblox::DHCP::IPv6Network objects.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
#Specify network my $network = Infoblox::DHCP::Network->new( network => "123.0.0.0/16", ); $expand_network->network($network);
#Specify IPv6 network my $network = Infoblox::DHCP::IPv6Network->new( network => "12::/68", ); $expand_network->network($network);
Use this method to specify the action for inheritable extensible attributes that exist on descendants if a parent network is deleted.
Valid value is "RETAIN" or "REMOVE".
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.
#Specify option_delete_ea $expand_network->option_delete_ea('RETAIN');
Use this method to specify the appropriate subnet mask to be expanded on the network.
Include the specified parameter to set the attribute value.
Number with the subnet mask value. This value must be 1 smaller then the subnet mask of the network to be expanded. The minimuim value is 8.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
#Specify prefix $expand_network->prefix(13);
The following sample code demonstrates different operations that can be applied to an object such as create, modify, and remove an object. This sample code also includes error handling for the operations.
#PROGRAM STARTS: Include all the modules that will be used use strict; use Infoblox;
#Create a session to the Infoblox appliance my $session = Infoblox::Session->new( master => "192.168.1.2", username => "admin", password => "infoblox" ); unless ($session) { die("Construct session failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Session created successfully\n";
#Create network prior to splitting the network my $network = Infoblox::DHCP::Network->new( network => "123.0.0.0/16", comment => "add network", ); unless($network){ die("Construct network object fail: ", Infoblox::status_code(). ":" .Infoblox::status_detail()); }
print"Network object created successfully.\n";
#Verify if the network exists my $object = $session->get( object => "Infoblox::DHCP::Network", network => "123.0.0.0/16" ); unless($object){ print"Network does not exist on server, safe to add the network.\n"; $session->add($network) or die("Add network failed: ", $session->status_code(). ":" .$session->status_detail()); }
print"Network added successfully.\n";
#Expand the network
my $expand_network = Infoblox::DHCP::ExpandNetwork->new ( network => $network, prefix => "13", auto_create_reversezone => "false", ); unless($expand_network){ die("Construct expand network object fail: ", Infoblox::status_code(). ":" .Infoblox::status_detail()); }
print"Expand network object created successfully.\n";
#Expand the network $session->add( $expand_network ) or die("Expand network fail:", $session->status_code(). ":" .$session->status_detail());
print "Expand network successfully.\n";
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session, Infoblox::Session->add(), Infoblox::DHCP::Network
Copyright (c) 2017 Infoblox Inc.