Git Product home page Git Product logo

Comments (6)

writememe avatar writememe commented on August 16, 2024

Hi @wdennis,

It's technically possible. All that function needs to return is the nr object. You could write a second function named get_nb_nr() and make sure it returns the object in the similar way.

I haven't used the netbox inventory plugin before, so perhaps you could share some code or an example?

from net-api.

writememe avatar writememe commented on August 16, 2024

Hi @wdennis,

Just following up on whether you wanted to share some code so I can take a look?

from net-api.

wdennis avatar wdennis commented on August 16, 2024

@writememe Sorry for late reply, been busy + holiday time here...
</excuse>

Example of my InitNornir invocation and the associated config file:

nr = InitNornir(
    config_file="config_nb_network_switches.yaml",
    dry_run=False,
)
nr.inventory.defaults.username = "superuser"
nr.inventory.defaults.password = "5uper53cre7"

config_nb_network_switches.yaml:

---
core:
    num_workers: 20
inventory:
    plugin: nornir.plugins.inventory.netbox.NBInventory
    options:
        nb_url: "http://netbox.mycompany.com"
        nb_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        use_slugs: True
        flatten_custom_fields: True
        filter_parameters:
            'role': ["core-switch", "distribution-switch", "access-switch", "transit-switch", "management-switch"]

This against Nornir 2.4.0; please note that the impending Nornir 3.0.0 will change things in regards to both the way plugins works, as well as the Netbox inventory plugin itself -- see:

from net-api.

writememe avatar writememe commented on August 16, 2024

Hi @wdennis all good mate, so am I :). I'm going to create a branch and work out what changes are needed to uplift the code to support nornir 3. When that's done and working, perhaps we can look at the new netbox plugin then?

from net-api.

wdennis avatar wdennis commented on August 16, 2024

from net-api.

writememe avatar writememe commented on August 16, 2024

Hi @wdennis, just finished the nornir 3 refactor now. If you pull the latest version of the code, you should be able to work from that now.

Haven't used netbox much to be honest, but I'm guessing it just need another get_nr function similar to line 97:

def get_nr():

With the netbox plugin in it? What are you thinking?

from net-api.

Related Issues (1)

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.