cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2907
Views
0
Helpful
6
Replies
Highlighted
Beginner

Python UCS SDK and connecting to UCS that uses Active Directory

Hello!

I am trying to use the Python UCS SDK to connect to a UCS that uses Active Directory for authentication. I have checked the API and the code and I don't seem to find a way to tell the login to add a Domain. Am I missing something? Can this be done? Does anyone have an example?

Thank you for your time!

6 REPLIES 6
Highlighted
Cisco Employee

Hi Jairo,

It sounds like you have Active Directory set up and a user created and want to login using this user. I tested the same in our environment using an AD defined user and have included the input for the getFaults sample. Here is the syntax that I used with that sample from the SDK:

Syntax: python getFaults.py -i 10.10.10.10 -u USER -p PASSWORD

As run: python getFaults.py -i 172.25.206.5 -u jeffoste -p Passw0rd

I think this is what you were looking for. If you want to configure your domain using the Python SDK, check out the following script sample that was submitted as part of our recent Scripting Contest that configures many attributes of a UCS Domain:

UCS Pod Configuration Script using Python SDK

Jeff

Highlighted

Hello Jeffrey,

Thank you for taking your time to answer my question and for the link to domain configuration.

If I use the scripts you mention with the login information, I get a connection failure.

Since I posted, we tested a lot of combinations of AD domains and usernames without success. To be able to progress with what we wanted to do, we ended up asking the administrator to create a local UCS account. I am not sure if a local account is required for using the Python UCS SDK as there is no specific mention of it in the documentation.

Thank you for your time!

Jairo

Highlighted
Cisco Employee

What is your default authentication in UCS Manager?  Is local or LDAP set as Native?  If LDAP is NOT set as default, then you need to provide your UCS Authentication Domain, like the following:

ucs-<UCS-Auth-Domain-Name>\<username>

So if your UCS authentication domain name is "ldap" and the username is "bob" it would look like this:

ucs-ldap\bob

Let me know if that helps.

Eric

Highlighted

Hello Eric,

Thank you for taking your time to answer my question.

As I posted in response to Jeffrey, we ended up having to have a local account in the UCS to be able to use the Python UCS SDK.

All I know is that to connect to the UCS Manager directly via web, I require a username, password and a domain, which I am guessing is an Active Directory managed login. I haven't seen a mention of a "domain" when using the Python UCS SDK. Part of my confusion is the use of the word "domain" as AD and UCS seem to use the word for different things.

I haven't tried the ucs-<Auth Domain-Name>\<username> combination, so I will attempt using that when I get to the office this week.

Thank you for your time!

Jairo

Highlighted

Jairo:

I understand.  I'll work with our doc teams to get this appended to both our Python and PowerShell SDK documents.

In this case, when I say domain, I am meaning the UCS authentication domain you define in UCS Manager.  If you wanted to specify AD domain you could do that as well like:

ucs-<UCS-Auth-Domain>\<AD-Domain\<username>

The reason we put ucs- in fromt is so we could have unique text to differ between the AD and UCS domains.  UCS Authentication domains can point to one or more LDAP auth, TACACs auth, RADIUS auth, and local authentication as defined in UCS Manager.     

Thanks,
Eric

Highlighted

Silly thing for newbies like me, backslash (\) is a special character in Python so have to use double backslash (\\)

I got this working today using "ucs-NA\\username"

2.4.1 String literals

Content for Community-Ad
This widget could not be displayed.