Monitoring, Management & Location Tracking

Airwave - Create multiple users from a CSV file

Introduction : This article provides a script and steps to create multiple users that need to login to Airwave.
This article uses a CSV file to accomplish the task.

 

Answer :

 

STEP1:

Create a CSV file with the rows and columns as mentioned in the image below.
rtaImage.jpg

The role ID can be determined by navigating to the AMP Setup-->Roles page and clicking on a particular role.
On the role page look into the URL for the role ID.

For example: By clicking on the pencil symbol for admin role I get the following URL information.

https://10.30.156.116/pref_roles?edit=1&id=9

Here the role ID for admin role is 9.
This same ID is to be used in the CSV file.

Copy the CSV file to the /tmp directory.



STEP 2:
Below is a script that needs to copied to /tmp directory using winScp or filezilla.


Script:

 
#!/bin/bash
while read line
do
password=$(echo $line | cut -d, -f2)
hashpassword=$(echo -n "dgc$password" | md5sum | cut -d ' ' -f1)
newline=$(echo $line | sed -e 's/'$password'/'$hashpassword'/')
/opt/airwave/pgsql/bin/psql -Uairwave airwave -c  "insert into users(username,password,role_id,full_name,email,phone,notes,password_format) values ('$(echo $newline | sed -e "s/,/','/g")');"

done


Run the script using following command:
# ./script <  <Name of imported csv file>

Note:
This script has been tested on Airwave version 7.7.4
Please consult with Aruba TAC before executing the script.

Version History
Revision #:
1 of 1
Last update:
‎07-08-2014 04:30 PM
Updated by:
 
Labels (1)
Contributors
Search Airheads
Showing results for 
Search instead for 
Did you mean: 
Is this a frequent problem?

Request an official Aruba knowledge base article to be written by our experts.