Comments (5)
@jiujing You may already have it , I tested below code and it ran perfectly fine
def get_nornir_by_your_func(some_args=None, num_workers=100): """Use any way to get some data(such as sql or restful api), and transform them into form as follwing""" data = [{'name': 'test1', 'hostname': 'xxxx', 'platform': 'junos', 'port': 22, 'username': 'xxxx', 'password': 'xxx', 'city': 'bj'}, ] runner = { "plugin": "threaded", "options": { "num_workers": num_workers, }, } inventory = { "plugin": "FlatDataInventory", "options": { "data": data, }, } nr = InitNornir(runner=runner, inventory=inventory) return nr if __name__ == '__main__': nr = get_nornir_by_your_func() bj_devs = nr.filter(city='bj') r = bj_devs.run(task=napalm_get, getters=['facts']) print_result(r)
It does work, if you do not want some connection options such as enable password . I did not support napalm especially. Some common arguments are same,such as username or password,So it does work ,when you use nornir_table_inventory with no sepical arguments.But some arguments are especial such as Connection Arguments Options. Nornir-table-inventory can parse data with "netmiko_" prefix to netmiko connection options.
from nornir.
I am closing this issue as I don't think this is related to nornir itself. Otherwise, feel free to reopen. If the issue is related to a plugin, it might be worth moving the conversation there.
Thanks!
from nornir.
nornir_table_inventory does support netmiko only. It does not support napalm.
Maybe It will support in the future.I will upgrade some functions .
from nornir.
nornir_table_inventory does support netmiko only. It does not support napalm. Maybe It will support in the future.I will upgrade some functions .
OK的 家人 已经用ntpalm实现功能了 感谢
from nornir.
@jiujing You may already have it , I tested below code and it ran perfectly fine
def get_nornir_by_your_func(some_args=None, num_workers=100):
"""Use any way to get some data(such as sql or restful api), and transform them into form as follwing"""
data = [{'name': 'test1', 'hostname': 'xxxx',
'platform': 'junos', 'port': 22, 'username': 'xxxx',
'password': 'xxx', 'city': 'bj'},
]
runner = {
"plugin": "threaded",
"options": {
"num_workers": num_workers,
},
}
inventory = {
"plugin": "FlatDataInventory",
"options": {
"data": data,
},
}
nr = InitNornir(runner=runner, inventory=inventory)
return nr
if __name__ == '__main__':
nr = get_nornir_by_your_func()
bj_devs = nr.filter(city='bj')
r = bj_devs.run(task=napalm_get, getters=['facts'])
print_result(r)
from nornir.
Related Issues (20)
- Re-run GitHub Actions Workflow HOT 8
- hostname Attribute error when NetBoxInventory2 plugin in use HOT 11
- Unable to pass enable secret to netmiko connection_options HOT 2
- plugin 'NetBoxInventory2' is not registered HOT 4
- NTC-Templates custom directory HOT 8
- Use disabled_algorithms with Nornir for SSH login using keys HOT 5
- Will Nornir be updated to support newer versions of dependencies such as typing-extensions v4.x? HOT 2
- Run nornir without config file
- Broken link on documentation mentioning Configuration
- nornir.plugin.runners.Threadedrunner() argument after ** must be a mapping, not str HOT 4
- Nornir run command will not work when converting to exe file HOT 3
- NORNIR error HOT 2
- Does support to initialize SimpleInventory with native objects still work? HOT 2
- SimpleInventory crashes with empty hosts file HOT 5
- Fallback to local credentials in case of TACACS unavailability HOT 2
- Can't get device state from Nornir HOT 5
- Create a second connection HOT 1
- No output from Cisco XR on "admin show inventory" HOT 2
- Threading Nornir with Netbox inventory HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nornir.