Skip to content

Create a VLANGroup in a script / in shell #18206

Answered by candlerb
aascedu asked this question in Help Wanted!
Discussion options

You must be logged in to vote

From the source:
https://github.com/netbox-community/netbox/blob/v4.1.7/netbox/ipam/models/vlans.py#L58-L62

vid_ranges is an ArrayField of IntegerRangeField, and the default value is a list containing a single Postgres NumericRange (which is not the same as a the range tuple you manufactured)

There is a utility function netbox.utilities.data.string_to_ranges which will convert the string format like "100-119,150-159" to a list of NumericRanges, so it's probably easiest if you just use that, but otherwise it should work if you use NumericRange imported from django.db.backends.postgresql.psycopg_any

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@aascedu
Comment options

Answer selected by aascedu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants