jeremystretch 3 лет назад
Родитель
Сommit
2cc2d2cc37

+ 33 - 0
docs/models/dcim/virtualdevicecontext.md

@@ -0,0 +1,33 @@
+# Virtual Device Context
+
+A virtual device context (VDC) represents a logical partition within a physical device, to which interfaces from the parent device can be allocated. Each VDC effectively provides an isolated control plane, but relies on shared resources of the parent device. A VDC is somewhat similar to a virtual machine in that it effects isolation between various components, but stops short of delivering a fully virtualized environment.
+
+Each VDC must be assigned to a device upon creation, after which interfaces belonging to that device can be assigned to one or more of its VDCs. A VDC can have any number of interfaces assigned to it, and an interface can belong to any number of VDCs.
+
+!!! info "A VDC by Any Other Name"
+    Network vendors use differing names for this concept. Cisco uses the term VDC, whereas Juniper refers to it as a _Virtual Routing Instance_, and Fortinet uses _Virtual Domain_, for instance. While there may be some nuance among the vendors' unique implementations, the general concept remains the same for each.
+
+## Fields
+
+### Device
+
+The device to which this VDC belongs.
+
+### Name
+
+The VDC's configured name. Must be unique to the assigned device.
+
+### Status
+
+The operational status of the VDC.
+
+### Identifier
+
+A vendor-prescribed unique identifier for the VDC (optional). Must be unique to the assigned device if defined.
+
+### Primary IPv4 & IPv6 Addresses
+
+Each VDC may designate one primary IPv4 address and/or one primary IPv6 address for management purposes.
+
+!!! tip
+    NetBox will prefer IPv6 addresses over IPv4 addresses by default. This can be changed by setting the `PREFER_IPV4` configuration parameter.

+ 7 - 0
docs/release-notes/version-3.4.md

@@ -17,6 +17,10 @@
 
 
 NetBox's global search functionality has been completely overhauled and replaced by a new cache-based lookup.
 NetBox's global search functionality has been completely overhauled and replaced by a new cache-based lookup.
 
 
+#### Virtual Device Contexts ([#7854](https://github.com/netbox-community/netbox/issues/7854))
+
+A new model representing virtual device contexts (VDCs) has been added. VDCs are logical partitions of resources within a device that can be managed independently. A VDC is created within a device and may have device interfaces assigned to it. An interface can be allocated to any number of VDCs on its device.
+
 ### JSON/YAML Bulk Imports ([#4347](https://github.com/netbox-community/netbox/issues/4347))
 ### JSON/YAML Bulk Imports ([#4347](https://github.com/netbox-community/netbox/issues/4347))
 
 
 NetBox's bulk import feature, which was previously limited to CSV-formatted data for most objects, has been extended to support the import of objects from JSON and/or YAML data as well.
 NetBox's bulk import feature, which was previously limited to CSV-formatted data for most objects, has been extended to support the import of objects from JSON and/or YAML data as well.
@@ -75,6 +79,7 @@ A new `PluginMenu` class has been introduced, which enables a plugin to inject a
 
 
 ### REST API Changes
 ### REST API Changes
 
 
+* Added the `/api/dcim/virtual-device-contexts/` endpoint
 * circuits.provider
 * circuits.provider
     * Removed the `asn`, `noc_contact`, `admin_contact`, and `portal_url` fields
     * Removed the `asn`, `noc_contact`, `admin_contact`, and `portal_url` fields
     * Added a `description` field
     * Added a `description` field
@@ -87,6 +92,8 @@ A new `PluginMenu` class has been introduced, which enables a plugin to inject a
     * Added optional `weight` and `weight_unit` fields
     * Added optional `weight` and `weight_unit` fields
 * dcim.Module
 * dcim.Module
     * Added a `description` field
     * Added a `description` field
+* dcim.Interface
+    * Added the `vdcs` field
 * dcim.ModuleType
 * dcim.ModuleType
     * Added a `description` field
     * Added a `description` field
     * Added optional `weight` and `weight_unit` fields
     * Added optional `weight` and `weight_unit` fields

+ 2 - 2
netbox/dcim/migrations/0166_virtualdevicecontext.py

@@ -45,10 +45,10 @@ class Migration(migrations.Migration):
         ),
         ),
         migrations.AddConstraint(
         migrations.AddConstraint(
             model_name='virtualdevicecontext',
             model_name='virtualdevicecontext',
-            constraint=models.UniqueConstraint(fields=('device', 'identifier'), name='dcim_virtualdevicecontext_device_identifiers'),
+            constraint=models.UniqueConstraint(fields=('device', 'identifier'), name='dcim_virtualdevicecontext_device_identifier'),
         ),
         ),
         migrations.AddConstraint(
         migrations.AddConstraint(
             model_name='virtualdevicecontext',
             model_name='virtualdevicecontext',
-            constraint=models.UniqueConstraint(fields=('device', 'name'), name='dcim_virtualdevicecontext_name'),
+            constraint=models.UniqueConstraint(fields=('device', 'name'), name='dcim_virtualdevicecontext_device_name'),
         ),
         ),
     ]
     ]

+ 2 - 2
netbox/dcim/models/devices.py

@@ -1117,11 +1117,11 @@ class VirtualDeviceContext(PrimaryModel):
         constraints = (
         constraints = (
             models.UniqueConstraint(
             models.UniqueConstraint(
                 fields=('device', 'identifier',),
                 fields=('device', 'identifier',),
-                name='%(app_label)s_%(class)s_device_identifiers'
+                name='%(app_label)s_%(class)s_device_identifier'
             ),
             ),
             models.UniqueConstraint(
             models.UniqueConstraint(
                 fields=('device', 'name',),
                 fields=('device', 'name',),
-                name='%(app_label)s_%(class)s_name'
+                name='%(app_label)s_%(class)s_device_name'
             ),
             ),
         )
         )