Instantiate driver based on driver string
See original GitHub issueWith a multi-vendor inventory, we would usually have the device type as a string such as ios
or eos
. In netmiko, this works well because we pass the driver as a string to ConnectHandler
but it seems that in scrapli, the only way is to explicitly import all drivers from scrapli.driver.core
(without using a workaround like __import__
).
With the current code it doesn’t seem straightforward to add a driver
key like in netmiko, but is there (or could there be) something like netmiko CLASS_MAPPER
(https://github.com/ktbyers/netmiko/blob/develop/netmiko/ssh_dispatcher.py#L98-L197) that associates driver names to their class so that we can instantiate a driver programmatically (with MAPPER[driver_name](**device) as...
) ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Why is string DRIVER being set? - java - Stack Overflow
The line is useless. In the early days of Java it was necessary to "initialize" the driver by running Class.forName(...) with the driver...
Read more >Loading JDBC Drivers - Baeldung
A typical driver registration routine will instantiate the driver instance and pass it over to the DriverManager.registerDriver method:
Read more >Initializing the Driver - PostgreSQL JDBC Driver
This section describes how to load and initialize the JDBC driver in your programs. Importing JDBC. Any source file that uses JDBC needs...
Read more >Creating a class driver - IBM
With a class driver, you can implement a dynamic class using any type of class, such as implementing all the dynamic classes of...
Read more >Establishing a Connection (The Java™ Tutorials > JDBC ...
This JDBC Java tutorial describes how to use JDBC API to create, insert into, ... A database connection URL is a string that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@carlmontanari I just tested and it works fine. Thanks !
Hello @carlmontanari
Thanks for the detailed answer ! I’ll create the driver mapping myself for now until this next release. I think the community driver repo is a great idea, it worked well for napalm.