Friday, June 5, 2020

I HATE CISCO'S SD-WAN REST API

WOW!!!

So today i finally tried out the Cisco SD-WAN sandbox on their DevNet site and HOOOOLY SHIT it was a shit show trying to get anything REST related to work!I'm sorry for swearing but my god i spent the last 4 hours trying every which way possible to get a API response call back for ANY API call in the end and EVERY F****** TIME i got this back.....

>>> arp= requests.get('https://10.10.20.90:8443/dataservice/device/arp?deviceI d=10.10.20.80', verify=False) C:\Users\<REMOVED>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib 3\connectionpool.py:979: InsecureRequestWarning: Unverified HTTPS request is bei ng made to host '10.10.20.90'. Adding certificate verification is strongly advis ed. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnin gs warnings.warn( >>> >>> print(arp.text) <html> <head> <title>Cisco vManage</title> <link rel="stylesheet" type="text/css" href="/login.css"> <link rel="stylesheet" type="text/css" href="/fonts/font-awesome-4.2.0/css/f ont-awesome.min.css"> <link rel="stylesheet" type="text/css" href="/bootstrap.min.css"> <script type="text/javascript" src="/javascript/jquery.js"></script> <link rel="icon" type="image/ico" href="/images/favicon.ico"/> <script> var count = 1, max = 30; function init(){ var rebootBlock = document.getElementById('reboot_message'); rebootBlock.style.display = "none"; var loginBlock = document.getElementById('login_message'); loginBlock.style.display = "block"; checkServerStatus(); } function checkServerStatus() { if(count <= max){ var xhr = new XMLHttpRequest(); xhr.open("GET", "/dataservice/client/server/ready", true); xhr.onload = function (e) { if (xhr.readyState === 4) { if (xhr.status === 200) { var rebootBlock = document.getElementById('reboot_message'); rebootBlock.style.display = "none"; var loginBlock = document.getElementById('login_message'); loginBlock.style.display = "block"; } else { var rebootBlock = document.getElementById('reboot_message'); rebootBlock.style.display = "block"; var loginBlock = document.getElementById('login_message'); loginBlock.style.display = "none"; count++; setTimeout(checkServerStatus, 10000); } } }; xhr.onerror = function (e) { count++; setTimeout(checkServerStatus, 10000); }; xhr.send(null); }else{ var rebootBlock = document.getElementById('reboot_message'); rebootBlock.style.display = "none"; var loginBlock = document.getElementById('login_message'); loginBlock.style.display = "block"; } } function validateForm() { if(loginForm.j_username.value.length==0 || loginForm.j_username.value==" ") { showErrorMessage("Invalid Username."); document.getElementById("j_username").className="login-input-error"; return false; } else if(loginForm.j_password.value.length == 0 || loginForm.j_password .value=="") { showErrorMessage("Invalid Password.") document.getElementById("j_password").className="login-input-error"; return false; } else { hideErrorMessage(); return true; } } function showErrorMessage(msg) { document.getElementById("errorMessageBox").innerHTML=msg; }; function hideErrorMessage() { document.getElementById("errorMessageBox").innerHTML=' '; document.getElementById("j_username").className="login-input-value"; document.getElementById("j_password").className="login-input-value"; } </script> </head> <body onload="init()"> <div name="Login" class="loginContainer"> <div class="loginInnerContainer"> <div class="productCategory">Cisco SD-WAN</div> <form class="loginFormStyle" name="loginForm" id="loginForm" method="POS T" action="j_security_check" onsubmit="return validateForm()" autocomplete="off" > <div name="logoMainContainer" class="logoMainContainer"></div> <div class="brand-logo-text"><span>Cisco vManage</span></div> <p id="errorMessageBox" name="errorMessageBox" class='errorMessageBox '></p> <div id="reboot_message" class="reboot-message-block"> <div class="reboot-message">Server is initializing. Please wait.</di v> <i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i> </div> <div id="login_message" style="display: none;"> <div class='onyx-groupbox login-wrap' name="inputFields"> <div class="onyx-input-decorator login-input"> <input type="text" class="login-input-value" size="18" id="j_username" name="j_username" maxlength="64" placeholde r="Username" value="" onfocus="hideErrorMessage()" autofocus /> </div> <div class="onyx-input-decorator login-input"> <input type="password" class="login-input-value" size="18" id="j_password" name="j_password" placeholder="Password" v alue="" onfocus="hideErrorMessage()" /> </div> </div> <div class='onyx-sample-tools login-wrap'> <input type="submit" name="submit" value="Log In" class="login-b utton" /> </div> </div> </form> </div> </div> </body> </html> 

EVERY....F******* TIME!!! I don't know if its just THAT API being a piece of shit or what but i stand by what i said on this thread a few days back.....GIVE ME PYTHON/NORNIR/NETMIKO/NAPALM ANYDAY OF THE WEEEEEEK.....Absolute JOKE.
I tried port 443, entering the creds in the request, even tried getting REST calls on the vManage box itself and STILL got the same error. THANKS FOR THE DOCUMENTATION EXPLAINING THIS CISCO....UNBELIEVABLE!
That is the most I've ever swore on Reddit but after spending almost 4 hours almost pulling my hair out trying every which way to get that useless thing to work, its justified!
I don't know if its just that API in particular being a bag of shit or me doing something wrong BUT THANKS FOR THE DOCUMENTATION ON HOW!!!! TO DO AN API CALL CORRECTLY, MY GOD I NEED A BREAK...Haha wow!



No comments:

Post a Comment