Giter Club home page Giter Club logo

Comments (5)

jiujing avatar jiujing commented on August 16, 2024 1

@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.

dbarrosop avatar dbarrosop commented on August 16, 2024 1

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.

jiujing avatar jiujing commented on August 16, 2024

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.

shijinlong12 avatar shijinlong12 commented on August 16, 2024

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.

kashyappatel1988 avatar kashyappatel1988 commented on August 16, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.