Infoblox::DHCP::MSServer - Microsoft (r) DHCP Server object.
This object is used to reference a Microsoft DHCP server.
my $member = Infoblox::DHCP::MSServer->new( address => $address, #Required name => $name, #Optional );
This section describes all the functions that you can apply to a DHCP MSServer object.
Use this function to specify a member for any of the above objects. See their respective documentation pages for parameters and return values.
my $member1 = Infoblox::DHCP::MSServer->new( address => "10.0.0.1", );
#Create the Network object with this member my $network = Infoblox::DHCP::Network->new( network => "10.0.0.0/255.0.0.0", members => [$member1], );
This section describes all the methods that you can use to set and retrieve the attribute values of a DHCP MSServer object.
Use this method to set or retrieve the address of the member.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The Microsoft DNS server address in IPV4 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 address my $address = $member->address(); #Modify address $member->address("192.168.1.3");
Use this method to set or retrieve the name of the member.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The Microsoft DNS server name in FQDN 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 name my $name = $member->name(); #Modify name $member->name("msserver.com");
The following sample code demonstrates the different functions that can be applied to an object, such as add, search, modify, and remove. This sample also includes error handling for the operations.
#Preparation prior to a DHCP MSServer object insertion
#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", #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 grid member object
my $grid_member = Infoblox::Grid::Member->new( name => "hostname.com", ipv4addr => "3.0.0.2", mask => "255.0.0.0", gateway => "3.0.0.1", comment => "Script Generated" ); unless ($grid_member) { die("Construct grid member object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Grid member object created successfully\n";
#Adding the member object to appliance through session my $response = $session->add( $grid_member );
unless ($response) { die("Add grid member failed: ", $session->status_code() . ":" . $session->status_detail()); } print"Grid member added successfully \n";
my $msserver = Infoblox::Grid::MSServer->new( address => '10.0.0.1', comment => 'basic member', disable => 'true', extensible_attributes => { Site => 'Local'}, login => 'user', password => 'password', managing_member => 'hostname.com', read_only => 'false', synchronization_interval => 5, logging_mode => 'minimum', );
unless ($msserver) { die("Construct grid MS DNS server object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Grid MS DNS server object created successfully\n";
#Adding the member object to appliance through session $response = $session->add( $msserver );
unless ($response) { die("Add grid MS DNS server failed: ", $session->status_code() . ":" . $session->status_detail()); } print"Grid MS DNS server added successfully \n";
#Create a DHCP MSServer object
my $member1 = Infoblox::DHCP::MSServer->new( address => "10.0.0.1", );
unless($member1) { die("Construct member failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Member object created successfully\n";
#Create the Network object with this member my $network = Infoblox::DHCP::Network->new( network => "10.0.0.0/255.0.0.0", comment => "add network", members => [ $member1 ] );
unless($network) { die("Construct Network object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Network object created successfully\n";
#Add the Network object into the Infoblox appliance through a session $session->add($network) or die("Add Network object failed: ", $session->status_code() . ":" . $session->status_detail()); print "DHCP member object added to the network successfully\n";
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::DHCP::Network, Infoblox::Session->add(),Infoblox::Session
Copyright (c) 2017 Infoblox Inc.