Importing users into NetMRI via the API

Here's a perl script that shows how you can use the API to import users into NetMRI

use strict;
use warnings;
use NetMRI::API;
# Comment this out if you are using HTTPS
$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;
# get the device id from the command# line as the first argument.
# Connect to the NetMRI.
my $client = new NetMRI::API({
     api_version =>
     '2.8',
 });
 ##################################
 #The "users_list.data" files needs to be in the following format
 #username,password,email,firstname,lastname
 #################################
 #open (READ_USERS, 'users_list.data');
 ##################################
 #Now we will read through each line in the file and assign them to variables
 ##################################
 my $broker = $client->broker->auth_user;
 while ( my $ask= ){
   my @list = split(/,/, $ask);
   my $list_username = $list[0];
   my $list_password = $list[1];
   my $list_email = $list[2];
   my $firstname = $list[3];
   my $lastname = $list[4];
   $broker->
   create(email =>list_email,first_name =>
    $firstname,last_name =>
    $lastname,password_secure =>
    $list_password,user_name =>
    $list_username);
 }
 
 

Comments
HWin
on ‎11-05-2013 11:39 PM

Encountered below when executing perl scripts which connecting to infoblox. The issue still persist even after trying to set SSL_CA_PATH and SSL_CA_FILE parameters in the script. How to eliminate all those messages.

UNIVERSAL->import is deprecated and will be removed in a future perl at C:/Perl64/site/lib/Infoblox/IBAPTypeUtil.pm line 12.
UNIVERSAL->import is deprecated and will be removed in a future perl at C:/Perl64/site/lib/Infoblox/IBAPTypes.pm line 15.
UNIVERSAL->import is deprecated and will be removed in a future perl at C:/Perl64/site/lib/Infoblox/IBAPSchema.pm line 13.
UNIVERSAL->import is deprecated and will be removed in a future perl at C:/Perl64/site/lib/Infoblox/Serialize.pm line 13.
connecting to : xxxxxxxxxxx_xxxx.xxxxx.xxxxxxxxxxx:
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER  together with SSL_ca_file|SSL_ca_path for verification.  If you really don't want to verify the certificate and keep the  connection open to Man-In-The-Middle attacks please set  SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
at C:/Perl64/site/lib/LWP/Protocol/http.pm line 31.

Adviser
on ‎11-07-2013 09:48 AM

Some how when this got posted this line should be two

# Comment this out if you are using HTTPS$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0; - See more at: http://community.infoblox.com/blogs/2013/10/01/importing-users-netmri-api#sthash.WdDCmEuD.dpuf

# Comment this out if you are using 

HTTPS$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0; 

I-Team Employee
on ‎11-18-2013 01:48 PM

I have corrected the script for the typo noted above. 

 

 

Showing results for 
Search instead for 
Do you mean