cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Choose one of the topics below for SD-WAN Resources to help you on your journey with SD-WAN

This community is for technical, feature, configuration and deployment questions.
For production deployment issues, please contact the TAC!
We will not comment or assist with your TAC case in these forums.

208
Views
5
Helpful
3
Replies
Highlighted
Beginner

Using Python to interact with the Cisco SD-WAN REST API (Learning Lab)

I'm stuck on "Step 1: Login and authenticate with Python code".

There's no command example to execute the #sdwan.py login.

Are we supposed to add the arguments for the 'url', 'username', 'password' in the command line.

Or, are the environment variables supposed to be changed? :

export SDWAN_IP=10.10.30.190

export SDWAN_USERNAME=admin

export SDWAN_PASSWORD=admin

 

example, change; SDWAN_IP="https://sandboxsdwan.cisco.com:8443/j_security_check"

Thanks (in advance).

(Or, should i give up DevNet and play more guitar?)

3 REPLIES 3
Beginner

Re: Using Python to interact with the Cisco SD-WAN REST API (Learning Lab)

Hi eggy!, this is eggy!

In reply to my own question:

You do in fact have to define those environment variables.

below are some 'prints' to show how they look as the login is stepped thru:

(venv) unknown28f07628886e:Getting-started-with-Cisco-SD-WAN-REST-APIs eggy$ ./sdwan.py template_list
base_url_str
https://sandboxsdwan.cisco.com:8443/
login_data
{'j_username': 'devnetuser', 'j_password': 'Cisco123!'}
login_url
https://sandboxsdwan.cisco.com:8443/j_security_check
url
https://sandboxsdwan.cisco.com:8443/j_security_check
login_response
<Response [200]>
Login Failed
(venv) unknown28f07628886e:Getting-started-with-Cisco-SD-WAN-REST-APIs eggy$ 

(Note: the Cisco code has an extra '/' after the port# that you have to remove).

However, I'm still getting a 'Login Failed', even thought the 'response' is giving a <Response [200]>
Isn't [200] a successful login?

 

omz Enthusiast
Enthusiast

Re: Using Python to interact with the Cisco SD-WAN REST API (Learning Lab)

Hi eggy

 

You have to change the variables in the script to point to the sandbox or setup local variables. 

export SDWAN_IP=https://sandboxsdwan.cisco.com:8443
export SDWAN_USERNAME=devnetuser
export SDWAN_PASSWORD=Cixxxxxxx

Just to let you know that for some reason the credentials are not working today they were working over the weekend as Postman worked :) 

Try with https://sandboxsdwan.cisco.com:8443 in the browser. 

omz Enthusiast
Enthusiast

Re: Using Python to interact with the Cisco SD-WAN REST API (Learning Lab)

Hi eggy 

Credentials reset. We can log in with the devnetuser now 

Regards

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards