Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'str' object has no attribute '_get_connection_options_recursively' #611

Closed
kamexX opened this issue Nov 17, 2020 · 2 comments

Comments

@kamexX
Copy link

kamexX commented Nov 17, 2020

I would like to get the interfaces from several network devices like ios/asa etc. I did everything like in the documentation tutorial part is shown.

from nornir import InitNornir
from nornir_napalm.plugins.tasks import napalm_cli
from nornir_utils.plugins.functions import print_result

nr = InitNornir(
    inventory={
        "plugin": "SimpleInventory",
        "options": {
            "host_file": "hosts.yaml",
            "group_file": "groups.yaml",
            "defaults_file": "defaults.yaml",
        }
    },
    dry_run=True,
)

result = nr.run(
    napalm_cli,
    commands=["show version", "show interfaces"],
)

print_result(result)

Instead of getting the Interfaces i got an error.

vvvv napalm_cli ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ERROR
Traceback (most recent call last):
  File "\AppData\Local\Programs\Python\Python38\lib\site-packages\nornir\core\task.py", line 98, in start
    r = self.task(self, **self.params)
  File " \AppData\Local\Programs\Python\Python38\lib\site-packages\nornir_napalm\plugins\tasks\napalm_cli.py", line 19, in napalm_cli
    device = task.host.get_connection(CONNECTION_NAME, task.nornir.config)
  File " \AppData\Local\Programs\Python\Python38\lib\site-packages\nornir\core\inventory.py", line 442, in get_connection
    conn = self.get_connection_parameters(connection)
  File " \AppData\Local\Programs\Python\Python38\lib\site-packages\nornir\core\inventory.py", line 373, in get_connection_parameters
    r = self._get_connection_options_recursively(connection)
  File " \AppData\Local\Programs\Python\Python38\lib\site-packages\nornir\core\inventory.py", line 405, in _get_connection_options_recursively
    sp = g._get_connection_options_recursively(connection)
AttributeError: 'str' object has no attribute '_get_connection_options_recursively'

^^^^ END napalm_cli ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Does anyone has a recommendation how to fix the error?

Best,
KamexX

@dbarrosop
Copy link
Contributor

Based on the error I don’t think your inventory files are correct

@dbarrosop
Copy link
Contributor

Closing as I don't think this is a nornir issue, feel free to reopen and provide more information if you think it is. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants