mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #6710: Fix assignment of VM interface parent via REST API
This commit is contained in:
@ -1,5 +1,13 @@
|
|||||||
# NetBox v2.11
|
# NetBox v2.11
|
||||||
|
|
||||||
|
## v2.11.9 (FUTURE)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#6710](https://github.com/netbox-community/netbox/issues/6710) - Fix assignment of VM interface parent via REST API
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## v2.11.8 (2021-07-06)
|
## v2.11.8 (2021-07-06)
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
@ -1211,8 +1211,9 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
|
|||||||
{
|
{
|
||||||
'device': device.pk,
|
'device': device.pk,
|
||||||
'name': 'Interface 6',
|
'name': 'Interface 6',
|
||||||
'type': '1000base-t',
|
'type': 'virtual',
|
||||||
'mode': InterfaceModeChoices.MODE_TAGGED,
|
'mode': InterfaceModeChoices.MODE_TAGGED,
|
||||||
|
'parent': interfaces[0].pk,
|
||||||
'tagged_vlans': [vlans[0].pk, vlans[1].pk],
|
'tagged_vlans': [vlans[0].pk, vlans[1].pk],
|
||||||
'untagged_vlan': vlans[2].pk,
|
'untagged_vlan': vlans[2].pk,
|
||||||
},
|
},
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from dcim.models import Interface
|
|
||||||
from netbox.api import WritableNestedSerializer
|
from netbox.api import WritableNestedSerializer
|
||||||
from virtualization.models import Cluster, ClusterGroup, ClusterType, VirtualMachine
|
from virtualization.models import Cluster, ClusterGroup, ClusterType, VirtualMachine, VMInterface
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'NestedClusterGroupSerializer',
|
'NestedClusterGroupSerializer',
|
||||||
@ -61,5 +60,5 @@ class NestedVMInterfaceSerializer(WritableNestedSerializer):
|
|||||||
virtual_machine = NestedVirtualMachineSerializer(read_only=True)
|
virtual_machine = NestedVirtualMachineSerializer(read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Interface
|
model = VMInterface
|
||||||
fields = ['id', 'url', 'display', 'virtual_machine', 'name']
|
fields = ['id', 'url', 'display', 'virtual_machine', 'name']
|
||||||
|
@ -251,6 +251,7 @@ class VMInterfaceTest(APIViewTestCases.APIViewTestCase):
|
|||||||
{
|
{
|
||||||
'virtual_machine': virtualmachine.pk,
|
'virtual_machine': virtualmachine.pk,
|
||||||
'name': 'Interface 6',
|
'name': 'Interface 6',
|
||||||
|
'parent': interfaces[0].pk,
|
||||||
'mode': InterfaceModeChoices.MODE_TAGGED,
|
'mode': InterfaceModeChoices.MODE_TAGGED,
|
||||||
'tagged_vlans': [vlans[0].pk, vlans[1].pk],
|
'tagged_vlans': [vlans[0].pk, vlans[1].pk],
|
||||||
'untagged_vlan': vlans[2].pk,
|
'untagged_vlan': vlans[2].pk,
|
||||||
|
Reference in New Issue
Block a user