Skip to content

Commit 9ae5865

Browse files
committed
Fixes #7865: REST API should support null values for console port speeds
1 parent c2d0cfd commit 9ae5865

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

docs/release-notes/version-3.0.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
* [#7851](https://github.com/netbox-community/netbox/issues/7851) - Add missing cluster name filter for virtual machines
2121
* [#7857](https://github.com/netbox-community/netbox/issues/7857) - Fix ordering IP addresses by assignment status
2222
* [#7859](https://github.com/netbox-community/netbox/issues/7859) - Fix styling of form widgets under cable connection views
23-
* [#7864](https://github.com/netbox-community/netbox/issues/7864) - `power_port` can be null when creating power outlets
23+
* [#7864](https://github.com/netbox-community/netbox/issues/7864) - `power_port` can be null when creating power outlets via REST API
24+
* [#7865](https://github.com/netbox-community/netbox/issues/7865) - REST API should support null values for console port speeds
2425

2526
---
2627

netbox/dcim/api/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ class ConsoleServerPortSerializer(PrimaryModelSerializer, CableTerminationSerial
539539
)
540540
speed = ChoiceField(
541541
choices=ConsolePortSpeedChoices,
542-
allow_blank=True,
542+
allow_null=True,
543543
required=False
544544
)
545545
cable = NestedCableSerializer(read_only=True)
@@ -563,7 +563,7 @@ class ConsolePortSerializer(PrimaryModelSerializer, CableTerminationSerializer,
563563
)
564564
speed = ChoiceField(
565565
choices=ConsolePortSpeedChoices,
566-
allow_blank=True,
566+
allow_null=True,
567567
required=False
568568
)
569569
cable = NestedCableSerializer(read_only=True)

netbox/dcim/tests/test_api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,14 +1042,17 @@ def setUpTestData(cls):
10421042
{
10431043
'device': device.pk,
10441044
'name': 'Console Port 4',
1045+
'speed': 9600,
10451046
},
10461047
{
10471048
'device': device.pk,
10481049
'name': 'Console Port 5',
1050+
'speed': 115200,
10491051
},
10501052
{
10511053
'device': device.pk,
10521054
'name': 'Console Port 6',
1055+
'speed': None,
10531056
},
10541057
]
10551058

@@ -1081,14 +1084,17 @@ def setUpTestData(cls):
10811084
{
10821085
'device': device.pk,
10831086
'name': 'Console Server Port 4',
1087+
'speed': 9600,
10841088
},
10851089
{
10861090
'device': device.pk,
10871091
'name': 'Console Server Port 5',
1092+
'speed': 115200,
10881093
},
10891094
{
10901095
'device': device.pk,
10911096
'name': 'Console Server Port 6',
1097+
'speed': None,
10921098
},
10931099
]
10941100

0 commit comments

Comments
 (0)