Skip to content

Commit c43125e

Browse files
authored
Enhancement: netbox_cable - Add tags (#455)
1 parent 81c229c commit c43125e

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

plugins/modules/netbox_cable.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@
145145
- in
146146
required: false
147147
type: str
148+
tags:
149+
description:
150+
- Any tags that the cable may need to be associated with
151+
required: false
152+
type: list
153+
elements: str
148154
state:
149155
description:
150156
- Use C(present) or C(absent) for adding or removing.
@@ -207,6 +213,8 @@
207213
color: abcdef
208214
length: 30
209215
length_unit: m
216+
tags:
217+
- foo
210218
state: present
211219
212220
- name: Delete cable within netbox
@@ -327,6 +335,7 @@ def main():
327335
length_unit=dict(
328336
required=False, choices=["m", "cm", "ft", "in"], type="str"
329337
),
338+
tags=dict(required=False, type="list", elements="str"),
330339
),
331340
),
332341
)

tests/integration/targets/latest/tasks/netbox_cable.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
color: abcdef
8181
length: 30
8282
length_unit: m
83+
tags:
84+
- "Schnozzberry"
8385
state: present
8486
register: test_three
8587

@@ -93,6 +95,7 @@
9395
- test_three['diff']['after']['color'] == "abcdef"
9496
- test_three['diff']['after']['length'] == 30
9597
- test_three['diff']['after']['length_unit'] == "m"
98+
- test_three['diff']['after']['tags'][0] == 4
9699
- test_three['cable']['termination_a_type'] == "dcim.interface"
97100
- test_three['cable']['termination_a_id'] == 13
98101
- test_three['cable']['termination_b_type'] == "dcim.interface"
@@ -103,6 +106,7 @@
103106
- test_three['cable']['color'] == "abcdef"
104107
- test_three['cable']['length'] == 30
105108
- test_three['cable']['length_unit'] == "m"
109+
- test_three['cable']['tags'][0] == 4
106110
- test_three['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 updated"
107111

108112
- name: "CABLE 4: ASSERT - Delete"

tests/integration/targets/v2.9/tasks/netbox_cable.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
color: abcdef
8181
length: 30
8282
length_unit: m
83+
tags:
84+
- "Schnozzberry"
8385
state: present
8486
register: test_three
8587

@@ -93,6 +95,7 @@
9395
- test_three['diff']['after']['color'] == "abcdef"
9496
- test_three['diff']['after']['length'] == 30
9597
- test_three['diff']['after']['length_unit'] == "m"
98+
- test_three['diff']['after']['tags'][0] == 4
9699
- test_three['cable']['termination_a_type'] == "dcim.interface"
97100
- test_three['cable']['termination_a_id'] == 13
98101
- test_three['cable']['termination_b_type'] == "dcim.interface"
@@ -103,6 +106,7 @@
103106
- test_three['cable']['color'] == "abcdef"
104107
- test_three['cable']['length'] == 30
105108
- test_three['cable']['length_unit'] == "m"
109+
- test_three['cable']['tags'][0] == 4
106110
- test_three['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 updated"
107111

108112
- name: "CABLE 4: ASSERT - Delete"

0 commit comments

Comments
 (0)