Infoblox::Grid::NatGroup - NAT Group object.
NAT Groups are necessary if the Grid master is behind a NAT device and there memberies behind both side of the NAT device. Any member on the same side as the master go into the same NAT group as the master and use their interface address for Grid communication with each other. Grid members on the other side of that NAT device do not go into the same NAT group as the master and use master's NAT address for Grid communication.
#Constructor for an NAT Group object my $nat_group = Infoblox::Grid::NatGroup->new ( name => $string #Required comment => $string #Optional / Default is empty );
The following functions are available to be applied to an NatGroup object
Use this function to specify a NatGroup. See Infoblox::Grid->nat_group_list() for parameters and return values.
# Retrieve the list of NatGroup objects from Grid object. my @retrieved_objs = $session->get( object => "Infoblox::Grid", name => "Infoblox" );
my $Grid_obj = $retrieved_objs[0];
# construct a NatGroup object my $nat_group = Infoblox::Grid::NatGroup->new ( name => "my_nat_group", comment => "inside NAT device");
# Modify Nat Group list. $Grid_obj->nat_group_list([$nat_group]);
This section describes all the methods that you can use to configure and retrieve the attribute value of a NatGroup.
Use this method to set or retrieve the descriptive comment.
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 = $nat_group->comment(); #Modify comment $nat_group->comment("new comment");
Use this method to set or retrieve a NAT group name
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Desired 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.
#Get NAT group name my $nat_group_name = $nat_group->name(); #Modify NAT group name $nat_group->name("new_group_name");
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";
#Add a NAT Group object
my @result_array = $session->get( "object" => "Infoblox::Grid", "name" => "Infoblox"); if( scalar( @result_array ) > 0 ) { my $Grid_obj = $result_array[0]; unless ($Grid_obj) { die("Get Grid object failed: ", $session->status_code() . ":" . $session->status_detail()); } # construct a NatGroup object my $nat_group = Infoblox::Grid::NatGroup->new ( name => "my_nat_group", comment => "inside NAT device");
# Add Nat Group to Grid object. $Grid_obj->nat_group_list([$nat_group]);
$session->modify($Grid_obj); print "NAT Group added to Grid object sucessfully\n"; }
#Modify existing NAT Group object
@result_array = $session->get( "object" => "Infoblox::Grid", "name" => "Infoblox"); if( scalar( @result_array ) > 0 ) { my $Grid_obj = $result_array[0]; unless ($Grid_obj) { die("Get Grid object failed: ", $session->status_code() . ":" . $session->status_detail()); }
# get Nat Group from Grid object. my $nat_groups_list = $Grid_obj->nat_group_list(); my $nat_group = @{$nat_groups_list}[0];
#modify the NAT group name $nat_group->name("new_nat_group_name");
# Add Nat Group to Grid object. $Grid_obj->nat_group_list([$nat_group]);
$session->modify($Grid_obj); print "NAT Group modified on Grid object sucessfully\n"; }
#Remove existing NAT Group object
@result_array = $session->get( "object" => "Infoblox::Grid", "name" => "Infoblox"); if( scalar( @result_array ) > 0 ) { my $Grid_obj = $result_array[0]; unless ($Grid_obj) { die("Get Grid object failed: ", $session->status_code() . ":" . $session->status_detail()); }
# empty Nat Group list on Grid object. $Grid_obj->nat_group_list([]);
$session->modify($Grid_obj); print "NAT Group removed on Grid object sucessfully\n"; }
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session, Infoblox::Session->get(), Infoblox::Session->modify()
Copyright (c) 2017 Infoblox Inc.