field 'last_updated' for dcim.interface is not updated on change of assigned MAC address #10829

Closed
opened 2025-12-29 21:36:23 +01:00 by adam · 2 comments
Owner

Originally created by @bb-Ricardo on GitHub (Feb 28, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.2.4

Python Version

3.12

Steps to Reproduce

  1. create interface
  2. note down the 'last_updated' field of interface
  3. create MAC address and assign it to interface
  4. check the 'last_updated' field of interface. It has not changed.
  5. delete MAC address which was created in step 3
  6. check the 'last_updated' field of interface. It has not changed.

Expected Behavior

I would expect the 'last_updated' field to set to the latest time stamp of altering the attributes of an interface

Observed Behavior

example output

before deleting the interface MAC address

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
      {
        "id": 92,
        "url": "http://netbox.test/api/dcim/interfaces/92/",
        "display_url": "http://netbox.test/dcim/interfaces/92/",
        "display": "vmk3",
        "device": {
          "id": 5,
          "url": "http://netbox.test/api/dcim/devices/5/",
          "display": "test-server-1",
          "name": "test-server-1",
          "description": ""
        },
        "vdcs": [],
        "module": null,
        "name": "vmk3",
        "label": "",
        "type": {
          "value": "virtual",
          "label": "Virtual"
        },
        "enabled": true,
        "parent": null,
        "bridge": null,
        "lag": null,
        "mtu": 9000,
        "mac_address": "00:50:56:6D:F1:12",
        "primary_mac_address": {
          "id": 994,
          "url": "http://netbox.test/api/dcim/mac-addresses/994/",
          "display": "00:50:56:6D:F1:12",
          "mac_address": "00:50:56:6D:F1:12",
          "description": ""
        },
        "mac_addresses": [
          {
            "id": 994,
            "url": "http://netbox.test/api/dcim/mac-addresses/994/",
            "display": "00:50:56:6D:F1:12",
            "mac_address": "00:50:56:6D:F1:12",
            "description": ""
          }
        ],
        "speed": null,
        "duplex": null,
        "wwn": null,
        "mgmt_only": false,
        "description": "Logging (vSwitch1, vlan ID: 4)",
        "mode": {
          "value": "access",
          "label": "Access"
        },
        "rf_role": null,
        "rf_channel": null,
        "poe_mode": null,
        "poe_type": null,
        "rf_channel_frequency": null,
        "rf_channel_width": null,
        "tx_power": null,
        "untagged_vlan": {
          "id": 50,
          "url": "http://netbox.test/api/ipam/vlans/50/",
          "display": "Logging (4)",
          "vid": 4,
          "name": "Logging",
          "description": ""
        },
        "tagged_vlans": [],
        "qinq_svlan": null,
        "vlan_translation_policy": null,
        "mark_connected": false,
        "cable": null,
        "cable_end": null,
        "wireless_link": null,
        "link_peers": [],
        "link_peers_type": null,
        "wireless_lans": [],
        "vrf": null,
        "l2vpn_termination": null,
        "connected_endpoints": null,
        "connected_endpoints_type": null,
        "connected_endpoints_reachable": null,
        "tags": [
          {
            "id": 2,
            "url": "http://netbox.test/api/extras/tags/2/",
            "display_url": "http://netbox.test/extras/tags/2/",
            "display": "NetBox-synced",
            "name": "NetBox-synced",
            "slug": "netbox-synced",
            "color": "9e9e9e"
          },
          {
            "id": 5,
            "url": "http://netbox.test/api/extras/tags/5/",
            "display_url": "http://netbox.test/extras/tags/5/",
            "display": "Source: vcsa",
            "name": "Source: vcsa",
            "slug": "source-vcsa",
            "color": "9e9e9e"
          }
        ],
        "custom_fields": {},
        "created": "2025-01-30T21:09:55.893715Z",
        "last_updated": "2025-02-22T09:01:28.492360Z",
        "count_ipaddresses": 1,
        "count_fhrp_groups": 0,
        "_occupied": false
      }
    ]
  }

after deleting the interface MAC address

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 92,
      "url": "http://netbox.test/api/dcim/interfaces/92/",
      "display_url": "http://netbox.test/dcim/interfaces/92/",
      "display": "vmk3",
      "device": {
        "id": 5,
        "url": "http://netbox.test/api/dcim/devices/5/",
        "display": "test-server-1",
        "name": "test-server-1",
        "description": ""
      },
      "vdcs": [],
      "module": null,
      "name": "vmk3",
      "label": "",
      "type": {
        "value": "virtual",
        "label": "Virtual"
      },
      "enabled": true,
      "parent": null,
      "bridge": null,
      "lag": null,
      "mtu": 9000,
      "mac_address": null,
      "primary_mac_address": null,
      "mac_addresses": [],
      "speed": null,
      "duplex": null,
      "wwn": null,
      "mgmt_only": false,
      "description": "Logging (vSwitch1, vlan ID: 4)",
      "mode": {
        "value": "access",
        "label": "Access"
      },
      "rf_role": null,
      "rf_channel": null,
      "poe_mode": null,
      "poe_type": null,
      "rf_channel_frequency": null,
      "rf_channel_width": null,
      "tx_power": null,
      "untagged_vlan": {
        "id": 50,
        "url": "http://netbox.test/api/ipam/vlans/50/",
        "display": "Logging (4)",
        "vid": 4,
        "name": "Logging",
        "description": ""
      },
      "tagged_vlans": [],
      "qinq_svlan": null,
      "vlan_translation_policy": null,
      "mark_connected": false,
      "cable": null,
      "cable_end": null,
      "wireless_link": null,
      "link_peers": [],
      "link_peers_type": null,
      "wireless_lans": [],
      "vrf": null,
      "l2vpn_termination": null,
      "connected_endpoints": null,
      "connected_endpoints_type": null,
      "connected_endpoints_reachable": null,
      "tags": [
        {
          "id": 2,
          "url": "http://netbox.test/api/extras/tags/2/",
          "display_url": "http://netbox.test/extras/tags/2/",
          "display": "NetBox-synced",
          "name": "NetBox-synced",
          "slug": "netbox-synced",
          "color": "9e9e9e"
        },
        {
          "id": 5,
          "url": "http://netbox.test/api/extras/tags/5/",
          "display_url": "http://netbox.test/extras/tags/5/",
          "display": "Source: vcsa",
          "name": "Source: vcsa",
          "slug": "source-vcsa",
          "color": "9e9e9e"
        }
      ],
      "custom_fields": {},
      "created": "2025-01-30T21:09:55.893715Z",
      "last_updated": "2025-02-22T09:01:28.492360Z",
      "count_ipaddresses": 1,
      "count_fhrp_groups": 0,
      "_occupied": false
    }
  ]
}
Originally created by @bb-Ricardo on GitHub (Feb 28, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.2.4 ### Python Version 3.12 ### Steps to Reproduce 1. create interface 2. note down the 'last_updated' field of interface 3. create MAC address and assign it to interface 4. check the 'last_updated' field of interface. It has not changed. 5. delete MAC address which was created in step 3 6. check the 'last_updated' field of interface. It has not changed. ### Expected Behavior I would expect the 'last_updated' field to set to the latest time stamp of altering the attributes of an interface ### Observed Behavior example output **before deleting the interface MAC address** ```json { "count": 1, "next": null, "previous": null, "results": [ { "id": 92, "url": "http://netbox.test/api/dcim/interfaces/92/", "display_url": "http://netbox.test/dcim/interfaces/92/", "display": "vmk3", "device": { "id": 5, "url": "http://netbox.test/api/dcim/devices/5/", "display": "test-server-1", "name": "test-server-1", "description": "" }, "vdcs": [], "module": null, "name": "vmk3", "label": "", "type": { "value": "virtual", "label": "Virtual" }, "enabled": true, "parent": null, "bridge": null, "lag": null, "mtu": 9000, "mac_address": "00:50:56:6D:F1:12", "primary_mac_address": { "id": 994, "url": "http://netbox.test/api/dcim/mac-addresses/994/", "display": "00:50:56:6D:F1:12", "mac_address": "00:50:56:6D:F1:12", "description": "" }, "mac_addresses": [ { "id": 994, "url": "http://netbox.test/api/dcim/mac-addresses/994/", "display": "00:50:56:6D:F1:12", "mac_address": "00:50:56:6D:F1:12", "description": "" } ], "speed": null, "duplex": null, "wwn": null, "mgmt_only": false, "description": "Logging (vSwitch1, vlan ID: 4)", "mode": { "value": "access", "label": "Access" }, "rf_role": null, "rf_channel": null, "poe_mode": null, "poe_type": null, "rf_channel_frequency": null, "rf_channel_width": null, "tx_power": null, "untagged_vlan": { "id": 50, "url": "http://netbox.test/api/ipam/vlans/50/", "display": "Logging (4)", "vid": 4, "name": "Logging", "description": "" }, "tagged_vlans": [], "qinq_svlan": null, "vlan_translation_policy": null, "mark_connected": false, "cable": null, "cable_end": null, "wireless_link": null, "link_peers": [], "link_peers_type": null, "wireless_lans": [], "vrf": null, "l2vpn_termination": null, "connected_endpoints": null, "connected_endpoints_type": null, "connected_endpoints_reachable": null, "tags": [ { "id": 2, "url": "http://netbox.test/api/extras/tags/2/", "display_url": "http://netbox.test/extras/tags/2/", "display": "NetBox-synced", "name": "NetBox-synced", "slug": "netbox-synced", "color": "9e9e9e" }, { "id": 5, "url": "http://netbox.test/api/extras/tags/5/", "display_url": "http://netbox.test/extras/tags/5/", "display": "Source: vcsa", "name": "Source: vcsa", "slug": "source-vcsa", "color": "9e9e9e" } ], "custom_fields": {}, "created": "2025-01-30T21:09:55.893715Z", "last_updated": "2025-02-22T09:01:28.492360Z", "count_ipaddresses": 1, "count_fhrp_groups": 0, "_occupied": false } ] } ``` **after deleting the interface MAC address** ```json { "count": 1, "next": null, "previous": null, "results": [ { "id": 92, "url": "http://netbox.test/api/dcim/interfaces/92/", "display_url": "http://netbox.test/dcim/interfaces/92/", "display": "vmk3", "device": { "id": 5, "url": "http://netbox.test/api/dcim/devices/5/", "display": "test-server-1", "name": "test-server-1", "description": "" }, "vdcs": [], "module": null, "name": "vmk3", "label": "", "type": { "value": "virtual", "label": "Virtual" }, "enabled": true, "parent": null, "bridge": null, "lag": null, "mtu": 9000, "mac_address": null, "primary_mac_address": null, "mac_addresses": [], "speed": null, "duplex": null, "wwn": null, "mgmt_only": false, "description": "Logging (vSwitch1, vlan ID: 4)", "mode": { "value": "access", "label": "Access" }, "rf_role": null, "rf_channel": null, "poe_mode": null, "poe_type": null, "rf_channel_frequency": null, "rf_channel_width": null, "tx_power": null, "untagged_vlan": { "id": 50, "url": "http://netbox.test/api/ipam/vlans/50/", "display": "Logging (4)", "vid": 4, "name": "Logging", "description": "" }, "tagged_vlans": [], "qinq_svlan": null, "vlan_translation_policy": null, "mark_connected": false, "cable": null, "cable_end": null, "wireless_link": null, "link_peers": [], "link_peers_type": null, "wireless_lans": [], "vrf": null, "l2vpn_termination": null, "connected_endpoints": null, "connected_endpoints_type": null, "connected_endpoints_reachable": null, "tags": [ { "id": 2, "url": "http://netbox.test/api/extras/tags/2/", "display_url": "http://netbox.test/extras/tags/2/", "display": "NetBox-synced", "name": "NetBox-synced", "slug": "netbox-synced", "color": "9e9e9e" }, { "id": 5, "url": "http://netbox.test/api/extras/tags/5/", "display_url": "http://netbox.test/extras/tags/5/", "display": "Source: vcsa", "name": "Source: vcsa", "slug": "source-vcsa", "color": "9e9e9e" } ], "custom_fields": {}, "created": "2025-01-30T21:09:55.893715Z", "last_updated": "2025-02-22T09:01:28.492360Z", "count_ipaddresses": 1, "count_fhrp_groups": 0, "_occupied": false } ] } ```
adam closed this issue 2025-12-29 21:36:23 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 28, 2025):

I would expect the 'last_updated' field to set to the latest time stamp of altering the attributes of an interface

The last updated time was not updated because the interface itself was not altered; rather, the MAC address assigned to the interface was. This is consistent with other objects in NetBox. (For example, the last updated time of a device is not altered when adding or removing an interface.)

Prior to NetBox v4.2, the last updated time of an interface would be updated when changing its MAC address, because mac_address was a concrete field on the model. This changed under FR #4867, which introduced a separate model used to represent MAC addresses.

@jeremystretch commented on GitHub (Feb 28, 2025): > I would expect the 'last_updated' field to set to the latest time stamp of altering the attributes of an interface The last updated time was not updated because the interface itself was not altered; rather, the MAC address assigned to the interface was. This is consistent with other objects in NetBox. (For example, the last updated time of a device is not altered when adding or removing an interface.) Prior to NetBox v4.2, the last updated time of an interface _would_ be updated when changing its MAC address, because `mac_address` was a concrete field on the model. This changed under FR #4867, which introduced a separate model used to represent MAC addresses.
Author
Owner

@bb-Ricardo commented on GitHub (Feb 28, 2025):

Hi @jeremystretch,

this seems a bit odd behaviour. If I request a list of all interfaces which have been updated since date X, then I will not get interfaces returned where the MAC address has been altered in any way since date X?

The same seems to apply for VLANs.

Deleting the VLAN itself: 'last_updated' will not be changed
Removing the VLAN assignment from the Interface: 'last_updated' will be changed.

The Result when requested via API looks the same: VLAN has been removed. But action causes the attribute to be updated and the other one doesn't.

This is quite inconsistent. How could this be solved?

@bb-Ricardo commented on GitHub (Feb 28, 2025): Hi @jeremystretch, this seems a bit odd behaviour. If I request a list of all interfaces which have been updated since date X, then I will not get interfaces returned where the MAC address has been altered in any way since date X? The same seems to apply for VLANs. Deleting the VLAN itself: 'last_updated' will not be changed Removing the VLAN assignment from the Interface: 'last_updated' will be changed. The Result when requested via API looks the same: VLAN has been removed. But action causes the attribute to be updated and the other one doesn't. This is quite inconsistent. How could this be solved?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10829