networktocode / ntc-netbox-plugin-onboarding

A plugin for NetBox to easily onboard new devices.
Other
246 stars 46 forks source link

Possibility to add a label while onbaording #70

Closed misch42 closed 3 years ago

misch42 commented 4 years ago

Environment

It would be nice to have the possibilty to add a label to onboarded devices. This could help when automating the follow-up processes after onboarding new devices.

Example:

  1. Onboard a new device with the label "new"
  2. For all devices with the label "new" 2.1 Trigger the collection of interface information 2.2 Delete the label "new"

So after onbaording a new deivce, additional information could be collected.

Proposed Functionality

See above

Use Case

See above

dgarros commented 4 years ago

Thanks @misch42, it would be a great addition. For the time being, I would suggest to onboard the new devices with different status like staged or planned.

misch42 commented 4 years ago

Yes. This would be even better. But hte onboarding pluging also does not offer to set the "Status" of new device. At least the config option does not work for me.

misch42 commented 4 years ago

See issue #58

mzbroch commented 3 years ago

In release 2.0 we introduced the onboarding extensions with an example as follows : https://github.com/networktocode/ntc-netbox-plugin-onboarding/blob/develop/docs/examples/example_ios_set_device_role.py - your use case is a perfect candidate for creating an extension.

Solution could be similar to the following one :

class MyOnboardingClass(Onboarding):
    def run(self, onboarding_kwargs):
        nb_k = NetboxKeeper(**onboarding_kwargs)
        nb_k.ensure_device()

        nb_k.device.tags.add("YOUR_LABEL_TAG")

        self.created_device = nb_k.device