networktocode/ntc-netbox-plugin-onboarding

Use Subnet in Onboarding Task Bulk Import

Dapsy2000 opened this issue · 1 comments

Environment

  • Python version: v3.6.9
  • NetBox version: v2.10.4
  • ntc-netbox-plugin-onboarding version: v2.1.0

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

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.