Skip to content

Commit 6dfb25f

Browse files
authored
Merge pull request #192 from netbox-community/feat/BIZ-3_issue189_choice_keys
BIZ-3 Add keys to ChoiceSets
2 parents 5304af4 + 1532570 commit 6dfb25f

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ __pycache__
55
dist
66
build
77
*.egg-info
8+
.idea/

develop/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG python_ver=3.8
1+
ARG python_ver=3.12
22
FROM python:${python_ver}
33

44
ARG netbox_ver=master

netbox_bgp/choices.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,37 @@
22

33

44
class CommunityStatusChoices(ChoiceSet):
5+
key = "Community.status"
56

67
STATUS_ACTIVE = 'active'
78
STATUS_RESERVED = 'reserved'
89
STATUS_DEPRECATED = 'deprecated'
910

10-
CHOICES = (
11+
CHOICES = [
1112
(STATUS_ACTIVE, 'Active', 'blue'),
1213
(STATUS_RESERVED, 'Reserved', 'cyan'),
1314
(STATUS_DEPRECATED, 'Deprecated', 'red'),
14-
)
15+
]
1516

1617

1718
class SessionStatusChoices(ChoiceSet):
19+
key = "Session.status"
1820

1921
STATUS_OFFLINE = 'offline'
2022
STATUS_ACTIVE = 'active'
2123
STATUS_PLANNED = 'planned'
2224
STATUS_FAILED = 'failed'
2325

24-
CHOICES = (
26+
CHOICES = [
2527
(STATUS_OFFLINE, 'Offline', 'orange'),
2628
(STATUS_ACTIVE, 'Active', 'green'),
2729
(STATUS_PLANNED, 'Planned', 'cyan'),
2830
(STATUS_FAILED, 'Failed', 'red'),
29-
)
31+
]
3032

3133

3234
class ActionChoices(ChoiceSet):
35+
key = "Action.status"
3336

3437
CHOICES = [
3538
('permit', 'Permit', 'green'),
@@ -38,6 +41,8 @@ class ActionChoices(ChoiceSet):
3841

3942

4043
class AFISAFIChoices(ChoiceSet):
44+
key = "AFISAFI.options"
45+
4146
AFISAFI_IPV4_UNICAST = 'ipv4-unicast'
4247
AFISAFI_IPV4_MULTICAST = 'ipv4-multicast'
4348
AFISAFI_IPV4_FLOWSPEC = 'ipv4-flowspec'
@@ -57,7 +62,7 @@ class AFISAFIChoices(ChoiceSet):
5762
AFISAFI_VPNV6_MULTICAST = 'vpnv6-multicast'
5863
AFISAFI_VPNV6_FLOWSPEC = 'vpnv6-flowspec'
5964

60-
CHOICES = (
65+
CHOICES = [
6166
(AFISAFI_IPV4_UNICAST, 'IPv4 Unicast'),
6267
(AFISAFI_IPV4_MULTICAST, 'IPv4 Multicast'),
6368
(AFISAFI_IPV4_FLOWSPEC, 'IPv4 Flowspec'),
@@ -71,7 +76,7 @@ class AFISAFIChoices(ChoiceSet):
7176
(AFISAFI_VPNV6_UNICAST, 'VPNv6 Unicast'),
7277
(AFISAFI_VPNV6_MULTICAST, 'VPNv6 Multicast'),
7378
(AFISAFI_VPNV6_FLOWSPEC, 'VPNv6 Flowspec')
74-
)
79+
]
7580

7681

7782
class IPAddressFamilyChoices(ChoiceSet):

netbox_bgp/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.13.0"
1+
__version__ = "0.13.1"

0 commit comments

Comments
 (0)