Skip to content

Commit 8f8bbdf

Browse files
committed
Add integration tests for adding mac address by id
1 parent 88adb24 commit 8f8bbdf

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

tests/integration/netbox-deploy.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,11 @@ def make_netbox_calls(endpoint, payload):
387387
"assigned_object_id": test100_gi2.id,
388388
"assigned_object_type": "dcim.interface",
389389
},
390+
{
391+
"mac_address": "AA:BB:CC:DD:EE:FF", # Identical to id 1
392+
"assigned_object_id": test100_gi2.id,
393+
"assigned_object_type": "dcim.interface",
394+
},
390395
]
391396
created_mac_addresses = make_netbox_calls(nb.dcim.mac_addresses, mac_addresses)
392397

tests/integration/targets/regression-v4.2/tasks/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,20 @@
282282
ansible.builtin.assert:
283283
that:
284284
- test_results.results.0.location.id != test_results.results.1.location.id
285+
286+
- name: "Issue #1413 - Update interface primary MAC by ID"
287+
netbox.netbox.netbox_device_interface:
288+
netbox_url: http://localhost:32768
289+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
290+
data:
291+
device: test100
292+
name: GigabitEthernet2
293+
primary_mac_address:
294+
id: 3
295+
state: present
296+
register: test_results
297+
298+
- name: "ASSERT Issue #1413"
299+
ansible.builtin.assert:
300+
that:
301+
- test_results['interface']['primary_mac_address'] == 3

tests/integration/targets/regression-v4.3/tasks/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,20 @@
282282
ansible.builtin.assert:
283283
that:
284284
- test_results.results.0.location.id != test_results.results.1.location.id
285+
286+
- name: "Issue #1413 - Update interface primary MAC by ID"
287+
netbox.netbox.netbox_device_interface:
288+
netbox_url: http://localhost:32768
289+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
290+
data:
291+
device: test100
292+
name: GigabitEthernet2
293+
primary_mac_address:
294+
id: 3
295+
state: present
296+
register: test_results
297+
298+
- name: "ASSERT Issue #1413"
299+
ansible.builtin.assert:
300+
that:
301+
- test_results['interface']['primary_mac_address'] == 3

0 commit comments

Comments
 (0)