networktocode / ntc-netbox-plugin-onboarding

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

Use Subnet in Onboarding Task Bulk Import #131

Closed Dapsy2000 closed 3 years ago

Dapsy2000 commented 3 years ago

Environment

Proposed Functionality

Is it possible to extend the Onboarding Task Bulk Import so that I also can pass a subnet?

For example:

site,ip_address,username,password

siteA,10.10.10.10,cisco,cisco
siteB,192.168.0.0/30,cisco,cisco

Then it checks the input and if there is a “/” present in the ip_address value it can trigger that code for example

import ipaddress

# get rid of network-id and broadcast address
network = ipaddress.ip_network(ip_address)

for ip-address in network.hosts():

    -> import ip-address and options like username, password etc. to Onboarding Task Bulk Import
site,ip_address,username,password

siteB,192.168.0.1,cisco,cisco
siteB,192.168.0.2,cisco,cisco

Exception Handling for wrong Net-ID:

ValueError: 192.168.1.0/23 has host bits set

Use Case

mzbroch commented 3 years ago

This is an interesting idea, but at the moment we do not have this feature on our road-map.

You might consider implementing a few-liner script that would discover active devices and for every active device create an onboarding task via API calls to NetBox.