From e880add3663cb2eba5c11c1aabc7097fd223c0e0 Mon Sep 17 00:00:00 2001 From: eggee Date: Sun, 16 Jun 2019 16:44:50 -0500 Subject: [PATCH 1/5] Remove the extra unecessary '/' from the login_action --- sdwan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdwan.py b/sdwan.py index 6354bd3..e1c46d5 100755 --- a/sdwan.py +++ b/sdwan.py @@ -42,7 +42,7 @@ def login(self, vmanage_ip, username, password): """Login to vmanage""" base_url_str = 'https://%s:8443/'%vmanage_ip - login_action = '/j_security_check' + login_action = 'j_security_check' #Format data for loginForm login_data = {'j_username' : username, 'j_password' : password} From 36437feb89e50d4a5ca565d23ecbcda176e281f6 Mon Sep 17 00:00:00 2001 From: eggee Date: Sun, 16 Jun 2019 16:47:03 -0500 Subject: [PATCH 2/5] Update README to use/reference python3.7 instead of 3.6 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 85c4cd0..89af6d4 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ devnet01.cisco.com --sysip 1.1.1.1 --loopip 2.2.2.2/24 --geip To use this application you will need: -* Python 3.6+ +* Python 3.7+ * Cisco SD-WAN 18+ * A Cisco SD-WAN account with permissions to attach and detach templates @@ -46,7 +46,7 @@ cd Getting-started-with-Cisco-SD-WAN-REST-APIs Setup Python Virtual Environment (requires Python 3.6+) ``` -python3.6 -m venv venv +python3.7 -m venv venv source venv/bin/activate pip install -r requirements.txt ``` From d50e084767806c5507734458b47373a5d56e746d Mon Sep 17 00:00:00 2001 From: eggee Date: Sun, 16 Jun 2019 16:51:40 -0500 Subject: [PATCH 3/5] Update README environment variables to point to the REST API and use working username/password values --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 89af6d4..a11e0a8 100644 --- a/README.md +++ b/README.md @@ -54,11 +54,11 @@ pip install -r requirements.txt Setup local environment variables for your Cisco SD-WAN fabric. Provide the info for your Cisco SD-WAN environment. Examples: - +"https://sandboxsdwan.cisco.com:8443/j_security_check" ``` -export SDWAN_IP=10.10.30.190 -export SDWAN_USERNAME=admin -export SDWAN_PASSWORD=admin +export SDWAN_IP=sandboxsdwan.cisco.com +export SDWAN_USERNAME=devnetuser +export SDWAN_PASSWORD=Cisco123! ``` ### Using the application From b8bf995eca2e4f09b870a2857e5841b45a9b859d Mon Sep 17 00:00:00 2001 From: eggee Date: Sun, 16 Jun 2019 16:58:44 -0500 Subject: [PATCH 4/5] Add print statements to show what was returned from the login attempt. --- sdwan.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdwan.py b/sdwan.py index e1c46d5..f4edd05 100755 --- a/sdwan.py +++ b/sdwan.py @@ -54,6 +54,8 @@ def login(self, vmanage_ip, username, password): sess = requests.session() #If the vmanage has a certificate signed by a trusted authority change verify to True login_response = sess.post(url=login_url, data=login_data, verify=False) + print('login_response') + print(login_response) if b'' in login_response.content: From 0dcdeaf9a4c9781be7726e8d5cc374bbc8ad0d53 Mon Sep 17 00:00:00 2001 From: eggee Date: Tue, 18 Jun 2019 07:46:24 -0500 Subject: [PATCH 5/5] working config. --- README.md | 2 +- sdwan.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a11e0a8..5588914 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ pip install -r requirements.txt Setup local environment variables for your Cisco SD-WAN fabric. Provide the info for your Cisco SD-WAN environment. Examples: -"https://sandboxsdwan.cisco.com:8443/j_security_check" + ``` export SDWAN_IP=sandboxsdwan.cisco.com export SDWAN_USERNAME=devnetuser diff --git a/sdwan.py b/sdwan.py index f4edd05..0c4c881 100755 --- a/sdwan.py +++ b/sdwan.py @@ -42,7 +42,7 @@ def login(self, vmanage_ip, username, password): """Login to vmanage""" base_url_str = 'https://%s:8443/'%vmanage_ip - login_action = 'j_security_check' + login_action = '/j_security_check' #Format data for loginForm login_data = {'j_username' : username, 'j_password' : password}