netbox-bgp
netbox-bgp copied to clipboard
Move Session model to use the NetBox core ASN model
ported @nahun's commit to latest k01ek/netbox-bgp@develop Credits: Nathan Wheeler [email protected] https://github.com/nahun/netbox-bgp/commit/6b870b086d46f58cb42e603b5daab3f6fb9d9ee1
NetBox v3.1 added a native ASN model. The plugin should utilize that model instead of a separate model that is specific to BGP.
Fixes https://github.com/k01ek/netbox-bgp/issues/82
I've added data migrations for ASN objects.
A native ASN object must be created for every ASN used in a BGPSession, before running this migration. Afterwards every Session will reference to the native ASN object.
Thanks @christianharendt and @nahun for your work, in next release I provide tool for migration plugin ASN objects to native NetBox ASN objects. So plugin ASN model will be removed later, I think in next minor release.
Thanks @k01ek I was also considering to create a native ASN object for each plugin ASN during migration, but the native ASN model has a mandatory field: RIR. I was unsure what to insert there as a safe default. Maybe the first RIR found or create a meta RIR "netbox-bgp"?
@christianharendt yea, just create some default RIR. I think change RIR for ASN is easier than create all ASN numbers by hands.
I've updated the code to be compatible with the latest develop commits