vcenter-netbox-sync icon indicating copy to clipboard operation
vcenter-netbox-sync copied to clipboard

Sync only prefix related ip-addresses

Open inetman28 opened this issue 5 years ago • 2 comments

Is your feature request related to a problem? Please describe. We must manually fill up ip-list IPV4-ALLOWED (IPV6-ALLOWED)

Describe the solution you'd like In some environment like own I already have fill up ip-prefixes in netbox. We can automate it and do not fill up ip-list manually.

inetman28 avatar May 07 '20 20:05 inetman28

@inetman28 Hello! How would you prefer this is automated? Are you suggesting that all prefixes which exist already inside the NetBox instance would be permitted and anything not created there would be ignored?

synackray avatar May 12 '20 11:05 synackray

@inetman28 Hello! How would you prefer this is automated? Are you suggesting that all prefixes which exist already inside the NetBox instance would be permitted and anything not created there would be ignored?

Yes, you are right. I mean something like this:

import pynetbox

IPV4_ALLOWED = []
IPV6_ALLOWED = []
all_prefixes = nb.ipam.prefixes.all()
for prefix in all_prefixes:
    if prefix.family.value == 4:
        IPV4_ALLOWED.append(prefix.prefix)
    elif prefix.family.value == 6:
        IPV6_ALLOWED.append(prefix.prefix)

inetman28 avatar May 12 '20 12:05 inetman28