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

GC platform_slug_map with nornir-nautobot dispatcher mapping can lead to issues #80

Open
jeffkala opened this issue May 4, 2023 · 2 comments

Comments

@jeffkala
Copy link
Contributor

jeffkala commented May 4, 2023

Seems like some interop with using platform_slug_map from golden config and overloading a platform from that map in the dispatcher.

GC user has platform map of:

        "platform_slug_map": {"junos": "juniper_junos"},

And dispatcher point to netmiko juniper_junos

        "dispatcher_mapping": {
            "juniper_junos": "nornir_nautobot.plugins.tasks.dispatcher.juniper_junos.NautobotNornirDriver"
        }

Issue:

with dispatcher_mapping set to juniper_junos getting:

Unable to find the driver for check_connectivity for platform: junos

if setting the dispatcher_mapping to junos getting:

                                      ^
syntax error, expecting <command>.

While debugging this is because its pulling back command to run based on default key which is show run.

Workaround is to update:

https://github.com/nautobot/nornir-nautobot/blob/bb977910f9e711fe2190a71d61b641f277e73b80/nornir_nautobot/plugins/tasks/dispatcher/default.py#LL29C1-L37C2

and in this case add a junos key.

@itdependsnetworks
Copy link
Contributor

Perhaps we should move this as a class attribute, so:

class NautobotNornirDriver(DefaultNautobotNornirDriver):

Would become

class NautobotNornirDriver(DefaultNautobotNornirDriver):
    """Collection of Nornir Tasks specific to Juniper Junos devices."""
    run_command = 'show configuration | display set'

and then update

    @staticmethod
    def get_config(task: Task, logger, obj, backup_file: str, remove_lines: list, substitute_lines: list) -> Result:
        """
        logger.log_debug(f"Executing get_config for {task.host.name} on {task.host.platform}")
        command = self.run_command

This would allow us to address issues we are seeing in ruckus as well.

@jvanderaa
Copy link
Contributor

Makes sense if I'm picking up what is being stated right.

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

3 participants