Skip to content

Commit

Permalink
Add tenant to netbox_cable (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
Larzenegger authored Jun 30, 2023
1 parent e062ce5 commit 0215e17
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/modules/netbox_cable.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@
required: false
type: dict
version_added: "3.6.0"
tenant:
description:
- Tenant who the cable will be assigned to
required: false
type: raw
version_added: "3.13.0"
"""

EXAMPLES = r"""
Expand Down Expand Up @@ -324,6 +330,7 @@ def main():
comments=dict(required=False, type="str"),
tags=dict(required=False, type="list", elements="raw"),
custom_fields=dict(required=False, type="dict"),
tenant=dict(required=False, type="raw"),
),
),
)
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/targets/v3.3/tasks/netbox_cable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
length_unit: m
tags:
- "Schnozzberry"
tenant: "Test Tenant"
state: present
register: test_three

Expand All @@ -96,6 +97,7 @@
- test_three['diff']['after']['length'] == 30
- test_three['diff']['after']['length_unit'] == "m"
- test_three['diff']['after']['tags'][0] == 4
- test_three['diff']['after']['tenant'] == 1
- test_three['cable']['termination_a_type'] == "dcim.interface"
- test_three['cable']['termination_a_id'] == 15
- test_three['cable']['termination_b_type'] == "dcim.interface"
Expand All @@ -107,6 +109,7 @@
- test_three['cable']['length'] == 30
- test_three['cable']['length_unit'] == "m"
- test_three['cable']['tags'][0] == 4
- test_three['cable']['tenant'] == 1
- test_three['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 updated"

- name: "CABLE 4: ASSERT - Delete"
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/targets/v3.4/tasks/netbox_cable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
length_unit: m
tags:
- "Schnozzberry"
tenant: "Test Tenant"
state: present
register: test_three

Expand All @@ -96,6 +97,7 @@
- test_three['diff']['after']['length'] == 30
- test_three['diff']['after']['length_unit'] == "m"
- test_three['diff']['after']['tags'][0] == 4
- test_three['diff']['after']['tenant'] == 1
- test_three['cable']['termination_a_type'] == "dcim.interface"
- test_three['cable']['termination_a_id'] == 15
- test_three['cable']['termination_b_type'] == "dcim.interface"
Expand All @@ -107,6 +109,7 @@
- test_three['cable']['length'] == 30
- test_three['cable']['length_unit'] == "m"
- test_three['cable']['tags'][0] == 4
- test_three['cable']['tenant'] == 1
- test_three['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 updated"

- name: "CABLE 4: ASSERT - Delete"
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/targets/v3.5/tasks/netbox_cable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
length_unit: m
tags:
- "Schnozzberry"
tenant: "Test Tenant"
state: present
register: test_three

Expand All @@ -96,6 +97,7 @@
- test_three['diff']['after']['length'] == 30
- test_three['diff']['after']['length_unit'] == "m"
- test_three['diff']['after']['tags'][0] == 4
- test_three['diff']['after']['tenant'] == 1
- test_three['cable']['termination_a_type'] == "dcim.interface"
- test_three['cable']['termination_a_id'] == 15
- test_three['cable']['termination_b_type'] == "dcim.interface"
Expand All @@ -107,6 +109,7 @@
- test_three['cable']['length'] == 30
- test_three['cable']['length_unit'] == "m"
- test_three['cable']['tags'][0] == 4
- test_three['cable']['tenant'] == 1
- test_three['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 updated"

- name: "CABLE 4: ASSERT - Delete"
Expand Down

0 comments on commit 0215e17

Please sign in to comment.