03-23-2017 08:00 AM
Dear Cisco,
My goal is to get the Python SDK ("cobra") for your APIC-EM controller running on my windows laptop.
I tried following the instructions here: https://cobra.readthedocs.io/en/latest/getting-started.html
I got stuck on the step titled "connecting and authenticating".
Although I cannot provide you with the actual strings I used for my user name and password, I can assure you that these credentials (which I stored in the variables username and password, respectively) are correct, as I was able to log into the web UI on the Controller with these credentials.
Verification that eggs are installed on my laptop:
c:\Python27\Scripts\egg123\Scripts>pip show acimodel
Name: acimodel
Version: 2.1-1h
Summary: The Management Information Tree
Home-page: UNKNOWN
Author: Cisco Systems
Author-email: mtimm@cisco.com
License: Cisco Systems Inc. (Copyright 2014)
Location: c:\python27\scripts\egg123\lib\site-packages\acimodel-2.1_1h-py2.7.egg
Requires: acicobra
c:\Python27\Scripts\egg123\Scripts>
c:\Python27\Scripts\egg123\Scripts>
c:\Python27\Scripts\egg123\Scripts>pip show acicobra
Name: acicobra
Version: 2.1-1h
Summary: Access API for the Management Information Tree
Home-page: UNKNOWN
Author: Cisco Systems
Author-email: gurssing@cisco.com
License: Cisco Systems Inc. (Copyright 2013 - 2014)
Location: c:\python27\scripts\egg123\lib\site-packages\acicobra-2.1_1h-py2.7.egg
Requires: setuptools, requests
c:\Python27\Scripts\egg123\Scripts>
Starting up Python after hitting "activate" in eggs:
(egg123) c:\Python27\Scripts\egg123\Scripts> python
>>> import os
>>> sys.path.append('c:\Python27\Scripts\egg123\Scripts')
>>>from cobra.mit.access import MoDirectory
>>>from cobra.mit.session import LoginSession
>>> loginSession = LoginSession(apicUrl, username, password)
>>> moDir = MoDirectory(loginSession)
>>> moDir.login()
c:\Python27\Scripts\egg123\lib\site-packages\requests-2.13.0-py2.7.egg\requests\packages\urllib3\connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request i
ml#ssl-warnings
InsecureRequestWarning)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python27\scripts\egg123\lib\site-packages\acicobra-2.1_1h-py2.7.egg\cobra\mit\access.py", line 27, in login
self._accessImpl.login()
File "c:\python27\scripts\egg123\lib\site-packages\acicobra-2.1_1h-py2.7.egg\cobra\internal\rest\accessimpl.py", line 121, in login
loginHandler.login(self._session)
File "c:\python27\scripts\egg123\lib\site-packages\acicobra-2.1_1h-py2.7.egg\cobra\internal\rest\accessimpl.py", line 74, in login
session._parseResponse(rsp)
File "c:\python27\scripts\egg123\lib\site-packages\acicobra-2.1_1h-py2.7.egg\cobra\mit\session.py", line 181, in _parseResponse
raise LoginError(errorCode, reasonStr)
cobra.mit.session.LoginError: Username or password is incorrect - FAILED local authentication
>>>.
What do I need to do to make this work?
Thanks,
D
03-23-2017 09:42 AM
My mistake on the password; logged in and successfully ran script from Cisco guy here:
: https://supportforums.cisco.com/document/12269926/example-getting-interface-status-cobra-sdk
we're good; you can close this one out as solved for now; thanks!
D
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide