cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
9807
Views
7
Helpful
10
Replies

Error while using aci-toolkit

chungewa
Cisco Employee
Cisco Employee

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

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

Omar Shorbaji
Level 1
Level 1

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

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

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

Thanks Omar:

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

jdanrich
Level 1
Level 1

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.

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.

Regards

Wassim

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

I have the same problem

Following commands solved the problem:

 

pip2 uninstall more_itertools

pip2 install more_itertools==5.0.0