Skip to content

Commit

Permalink
Merge pull request #340 from pugnacity/interface_labels
Browse files Browse the repository at this point in the history
allow to set labels and description for device_interface_templates
  • Loading branch information
joewesch authored Apr 25, 2024
2 parents 5181b72 + 2a79fbc commit 5b3702f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions plugins/modules/device_interface_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@
required: false
type: bool
version_added: "3.0.0"
label:
description:
- Label of the interface template to be created
required: false
type: str
version_added: "5.2.0"
description:
description:
- Description of the interface
required: false
type: str
version_added: "5.2.0"
"""

EXAMPLES = r"""
Expand Down Expand Up @@ -110,6 +122,8 @@ def main():
type="str",
),
mgmt_only=dict(required=False, type="bool"),
label=dict(required=False, type="str"),
description=dict(required=False, type="str"),
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
device_type: Arista Test
name: 10GBASE-T (10GE)
type: 10gbase-t
label: net1
description: "create interface"
register: test_one

- name: "1 - ASSERT"
Expand All @@ -26,6 +28,8 @@
- test_one['interface_template']['name'] == "10GBASE-T (10GE)"
- test_one['interface_template']['device_type'] == dt_arista['key']
- test_one['interface_template']['type'] == '10gbase-t'
- test_one['interface_template']['label'] == 'net1'
- test_one['interface_template']['description'] == 'create interface'

- name: "2 - Update 10GBASE-T (10GE)"
networktocode.nautobot.device_interface_template:
Expand All @@ -34,6 +38,8 @@
device_type: Arista Test
name: 10GBASE-T (10GE)
type: 10gbase-t
label: net0
description: "update interface"
mgmt_only: true
register: test_two

Expand All @@ -43,9 +49,13 @@
- test_two is changed
- test_two['msg'] == "interface_template 10GBASE-T (10GE) updated"
- test_two['diff']['after']['mgmt_only'] == true
- test_two['diff']['after']['label'] == "net0"
- test_two['diff']['after']['description'] == "update interface"
- test_two['interface_template']['name'] == "10GBASE-T (10GE)"
- test_two['interface_template']['device_type'] == dt_arista['key']
- test_two['interface_template']['mgmt_only'] == true
- test_two['interface_template']['label'] == "net0"
- test_two['interface_template']['description'] == "update interface"

- name: "3 - Delete interface template 10GBASE-T (10GE)"
networktocode.nautobot.device_interface_template:
Expand Down

0 comments on commit 5b3702f

Please sign in to comment.