1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes: #7854 - Add VDC/Instances/etc (#10787)

* Work on #7854

* Move to new URL scheme.

* Fix PEP8 errors

* Fix PEP8 errors

* Add GraphQL and fix primary_ip missing

* Fix PEP8 on GQL Type

* Fix missing NestedSerializer.

* Fix missing NestedSerializer & rename VDC to VDCs

* Fix migration

* Change Validation for identifier

* Fix missing migration

* Rebase to feature

* Post-review changes

* Remove VDC Type
* Remove M2M Enforcement logic

* Interface related changes

* Add filter fields to filterset for Interface filter
* Add form field to filterset form for Interface filter
* Add VDC display to interface detail template

* Remove VirtualDeviceContextTypeChoices

* Accommodate recent changes in feature branch

* Add tests
Add missing search()

* Update tests, and fix model form

* Update test_api

* Update test_api.InterfaceTest create_data

* Fix issue with tests

* Update interface serializer

* Update serializer and tests

* Update status to be required

* Remove error message for constraint

* Remove extraneous import

* Re-ordered devices menu to place VDC below virtual chassis

* Add helptext for `identifier` field

* Fix breadcrumb link

* Remove add interface link

* Add missing tenant and status fields

* Changes to tests as per Jeremy

* Change for #9623

Co-authored-by: Jeremy Stretch <jstretch@ns1.com>

* Update filterset form for status field

* Remove Rename View

* Change tabs to spaces

* Update netbox/dcim/tables/devices.py

Co-authored-by: Jeremy Stretch <jstretch@ns1.com>

* Update netbox/dcim/tables/devices.py

Co-authored-by: Jeremy Stretch <jstretch@ns1.com>

* Fix tenant in bulk_edit

* Apply suggestions from code review

Co-authored-by: Jeremy Stretch <jstretch@ns1.com>

* Add status field to table.

* Re-order table fields.

Co-authored-by: Jeremy Stretch <jstretch@ns1.com>
This commit is contained in:
Daniel Sheppard
2022-11-11 06:55:49 -06:00
committed by GitHub
parent 653acbf62c
commit b374351154
27 changed files with 890 additions and 14 deletions

View File

@@ -1485,6 +1485,12 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
)
Interface.objects.bulk_create(interfaces)
vdcs = (
VirtualDeviceContext(name='VDC 1', identifier=1, device=device),
VirtualDeviceContext(name='VDC 2', identifier=2, device=device)
)
VirtualDeviceContext.objects.bulk_create(vdcs)
vlans = (
VLAN(name='VLAN 1', vid=1),
VLAN(name='VLAN 2', vid=2),
@@ -1533,6 +1539,7 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
},
{
'device': device.pk,
'vdcs': [vdcs[0].pk],
'name': 'Interface 6',
'type': 'virtual',
'mode': InterfaceModeChoices.MODE_TAGGED,
@@ -1543,6 +1550,7 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
},
{
'device': device.pk,
'vdcs': [vdcs[1].pk],
'name': 'Interface 7',
'type': InterfaceTypeChoices.TYPE_80211A,
'tx_power': 10,
@@ -1551,6 +1559,7 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
},
{
'device': device.pk,
'vdcs': [vdcs[1].pk],
'name': 'Interface 8',
'type': InterfaceTypeChoices.TYPE_80211A,
'tx_power': 10,
@@ -2163,3 +2172,57 @@ class PowerFeedTest(APIViewTestCases.APIViewTestCase):
'type': REDUNDANT,
},
]
class VirtualDeviceContextTest(APIViewTestCases.APIViewTestCase):
model = VirtualDeviceContext
brief_fields = ['device', 'display', 'id', 'identifier', 'name', 'url']
bulk_update_data = {
'status': 'planned',
}
@classmethod
def setUpTestData(cls):
site = Site.objects.create(name='Test Site', slug='test-site')
manufacturer = Manufacturer.objects.create(name='Manufacturer 1', slug='manufacturer-1')
devicetype = DeviceType.objects.create(manufacturer=manufacturer, model='Device Type', slug='device-type')
devicerole = DeviceRole.objects.create(name='Device Role', slug='device-role', color='ff0000')
devices = (
Device(name='Device 1', device_type=devicetype, device_role=devicerole, site=site),
Device(name='Device 2', device_type=devicetype, device_role=devicerole, site=site),
Device(name='Device 3', device_type=devicetype, device_role=devicerole, site=site),
)
Device.objects.bulk_create(devices)
vdcs = (
VirtualDeviceContext(device=devices[1], name='VDC 1', identifier=1, status='active'),
VirtualDeviceContext(device=devices[1], name='VDC 2', identifier=2, status='active'),
VirtualDeviceContext(device=devices[2], name='VDC 1', identifier=1, status='active'),
VirtualDeviceContext(device=devices[2], name='VDC 2', identifier=2, status='active'),
VirtualDeviceContext(device=devices[2], name='VDC 3', identifier=3, status='active'),
VirtualDeviceContext(device=devices[2], name='VDC 4', identifier=4, status='active'),
VirtualDeviceContext(device=devices[2], name='VDC 5', identifier=5, status='active'),
)
VirtualDeviceContext.objects.bulk_create(vdcs)
cls.create_data = [
{
'device': devices[0].pk,
'status': 'active',
'name': 'VDC 1',
'identifier': 1,
},
{
'device': devices[0].pk,
'status': 'active',
'name': 'VDC 2',
'identifier': 2,
},
{
'device': devices[1].pk,
'status': 'active',
'name': 'VDC 3',
'identifier': 3,
},
]