cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5151
Views
1
Helpful
10
Replies
Highlighted
Cisco Employee

Error while using aci-toolkit

HI, Guys

I'm using Python2.7 and ACI SDK, and i can create Tenant into my APIC successfully.

But When i try to create Tenant from ACI-toolkit, i got the error:

Thanks for your sharing

Jason

Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32

Type "copyright", "credits" or "license()" for more information.

>>> from acitoolkit import *

>>> from credentails import *

Traceback (most recent call last):

  File "<pyshell#1>", line 1, in <module>

    from credentails import *

ImportError: No module named credentails   // so i using the following to login

>>> apicUrl = 'https://my-aci-address'

>>> from cobra.mit.access import MoDirectory

>>> from cobra.mit.session import LoginSession

>>> loginSession = LoginSession(apicUrl,'admin','cisco123')

>>> moDir = MoDirectory(loginSession)

>>> moDir.login()

>>> tenant = Tenant ('chungewa-ten2')

Traceback (most recent call last):

  File "<pyshell#9>", line 1, in <module>

    tenant = Tenant ('chungewa-ten2')

                          NameError: name 'Tenant' is not defined   where am I wrong

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hello,

Here is some information in the samples/README.md

"Many of the samples in this directory use the file credentials.py to login to the APIC.  Before running, edit the credentials.py with the username, password, and IP address for your environment."

So create a credentials.py file in the same directory as your code and have in it values for URL, LOGIN and PASSWORD as the credentials to access the APIC. Below is an example.

## credentials.py

URL="http://127.0.0.1"

LOGIN="chungewa"

PASSWORD="Cisco123"

- Omar

View solution in original post

10 REPLIES 10
Highlighted
Beginner

Hi Jason,

It looks to me that you need to do a couple of things:

First,

from acitoolkit.acitoolkit import *

instead of

from acitoolkit import *

Second, check the spelling of credentials. You spell it as credentails ("a" and "i" are reversed). I do not know if that is intentional.

- Omar

Highlighted

HI, Omar

after reinstall acitoolkit, i'v referenced this http://datacenter.github.io/acitoolkit/docsbuild/html/tutorial.html#building-a-simple-tenant-configuration

Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32

Type "copyright", "credits" or "license()" for more information.

>>> from acitoolkit.acitoolkit import *

>>> from credentials import *         //copied from in above URL

Traceback (most recent call last):

  File "<pyshell#1>", line 1, in <module>

    from credentials import *

ImportError: No module named credentials

Highlighted

Hello,

Here is some information in the samples/README.md

"Many of the samples in this directory use the file credentials.py to login to the APIC.  Before running, edit the credentials.py with the username, password, and IP address for your environment."

So create a credentials.py file in the same directory as your code and have in it values for URL, LOGIN and PASSWORD as the credentials to access the APIC. Below is an example.

## credentials.py

URL="http://127.0.0.1"

LOGIN="chungewa"

PASSWORD="Cisco123"

- Omar

View solution in original post

Highlighted

Thanks Omar:

modify credentials.py and put under my python2.7 directory, that works.

Highlighted
Beginner

I am having the same issue.. But it's not credential related..

$ python aci-doc.py

Traceback (most recent call last):

  File "aci-doc.py", line 4, in <module>

    import cobra.mit.access

ImportError: No module named cobra.mit.access

I've searched and I don't appear to have this module anywhere..  Does anyone know a location to download it from? I've seen it on "ReadTheDocs" website, but nothing official that I can find on Cisco.

Highlighted

Have you installed SDK Cobra egg files? Are you using Python 2.7 or 3?

Python 3 does not work. The whole thing works under Pyhton 2.7.

 

Keyboard Banger

Highlighted
Highlighted

I'm also having some trouble importing the acitoolkit module.

This is the error that I get:

 

>>> from acitoolkit.acitoolkit import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build\bdist.win-amd64\egg\acitoolkit\__init__.py", line 30, in <module>
  File "build\bdist.win-amd64\egg\acitoolkit\aciFaults.py", line 6, in <module>
  File "C:\Users\dfvieiragoncalves\code\py2-venv\lib\site-packages\jsonschema-3.2.0-py2.7.egg\jsonschema\__init__.py", line 33, in <module>
    import importlib_metadata as metadata
  File "C:\Users\dfvieiragoncalves\code\py2-venv\lib\site-packages\importlib_metadata-1.2.0-py2.7.egg\importlib_metadata\__init__.py", line 9, in <module>
    import zipp
  File "C:\Users\dfvieiragoncalves\code\py2-venv\lib\site-packages\zipp-0.6.0-py2.7.egg\zipp.py", line 12, in <module>
    import more_itertools
  File "build\bdist.win-amd64\egg\more_itertools\__init__.py", line 1, in <module>
  File "C:\Users\dfvieiragoncalves\code\py2-venv\lib\site-packages\more_itertools-8.0.2-py2.7.egg\more_itertools\more.py", line 460
    yield from iterable
             ^
SyntaxError: invalid syntax
Highlighted

I have the same problem

Highlighted

Following commands solved the problem:

 

pip2 uninstall more_itertools

pip2 install more_itertools==5.0.0

Content for Community-Ad