cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1442
Views
0
Helpful
7
Replies

How to add multiple users in bulk

00 stack
Level 1
Level 1

Hi, I would like to register multiple users at once to CML2.

I looked at the WebUI and API documentation, but it seems that you can only create one person at a time.
Is there any way to do this?

1 Accepted Solution

Accepted Solutions

shin.sterneck
Level 1
Level 1

Hi 00 stack,

 

you mentioned that you looked at the API Documentation. The API Documentation lists the path "/users/{user_id}" with the POST method, which will give you the option to programmatically create the users. Create a simple script that loops through your list of user accounts that you would like to create.

 

The more dangerous method would be to look at the local CML database via the CLI. I Did not try this but there is a SQLite database, which CML uses. It is located at "/var/local/virl2/config/controller.db" and contains a table called "user" with the following schema. Maybe this helps, however I highly recommend not doing that and instead use the API, which is what it is for.

 

# sqlite3 /var/local/virl2/config/controller.db
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
sqlite> .schema user
CREATE TABLE user (
id VARCHAR NOT NULL,
created DATETIME,
modified DATETIME,
username VARCHAR(20) NOT NULL,
password_hash VARCHAR NOT NULL,
fullname VARCHAR,
description VARCHAR,
admin BOOLEAN,
PRIMARY KEY (id),
UNIQUE (username)
);

 

Regards,

Shin

View solution in original post

7 Replies 7

balaji.bandi
Hall of Fame
Hall of Fame

I think that is limitation i guess here. is this personal edition ?

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Hi, I use CML2 enterprise.

 

I think that there is no choice but to process the API repeatedly with scripts etc.

May this is a feature request i guess here. ( iam CML personal user never tried multi users.)

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

I thought there might be a way to do this that I just don't know about, but there seems to be no way to do that.

 

I will ask this question to support teams.

 

Regards,

shin.sterneck
Level 1
Level 1

Hi 00 stack,

 

you mentioned that you looked at the API Documentation. The API Documentation lists the path "/users/{user_id}" with the POST method, which will give you the option to programmatically create the users. Create a simple script that loops through your list of user accounts that you would like to create.

 

The more dangerous method would be to look at the local CML database via the CLI. I Did not try this but there is a SQLite database, which CML uses. It is located at "/var/local/virl2/config/controller.db" and contains a table called "user" with the following schema. Maybe this helps, however I highly recommend not doing that and instead use the API, which is what it is for.

 

# sqlite3 /var/local/virl2/config/controller.db
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
sqlite> .schema user
CREATE TABLE user (
id VARCHAR NOT NULL,
created DATETIME,
modified DATETIME,
username VARCHAR(20) NOT NULL,
password_hash VARCHAR NOT NULL,
fullname VARCHAR,
description VARCHAR,
admin BOOLEAN,
PRIMARY KEY (id),
UNIQUE (username)
);

 

Regards,

Shin

Hi Shin,

 

Thank you for your reply.

 

I'll try to use API and scrpt.

 

The new version 2.3 seems to be able to use LDAP for user management, so I am going to try it sometime.

 

Regards,

Hi 00 stack,

 

nice, I just checked out the LDAP feature in the documentation and will give that a try as well! Thanks for sharing this info!

 

Regards,

Shin