Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'created' and 'last_updated' attributes to virtualization component models #6257

Closed
bb-Ricardo opened this issue Apr 23, 2021 · 3 comments
Labels
type: feature Introduction of new functionality to the application

Comments

@bb-Ricardo
Copy link

NetBox version

v2.11.1

Feature type

Data model extension

Proposed functionality

Add created and last_updated attributes to virtualization models.

See: #5369 and #5901

Use case

I use Netbox as source for our monitoring system. There it is important to get interface data for all interfaces of Device/VM. In order to avoid requesting all interfaces of all devices/VMs a caching was implemented to get only interface objects which have changed since last request cycle. This works pretty well for devices, VMs and IP addresses but interfaces don't support these fields. Our NetBox instance contains thousends of interfaces and retreiving them all takes a long time.

This change would speed up the reading of interface data by A LOT.

Database changes

Yes. Adding 'created' and 'last_updated' to all virtualization models would be necessary.

External dependencies

None

@bb-Ricardo bb-Ricardo added the type: feature Introduction of new functionality to the application label Apr 23, 2021
@jeremystretch
Copy link
Member

These fields already exist on these models. What specific change(s) are you proposing?

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Apr 23, 2021
@bb-Ricardo
Copy link
Author

Hi, Jeremy.

Yes, you are correct. I found the Issue.

is the attribute filter "last_updated__gte" supported for data models with the "last_updated" attribute?

I used following query /api/dcim/interfaces/?last_updated__gte=2021-04-23T14:08:37.536301Z and it returned interfaces like this example:

{
    "id": 8801,
    "url": "https://example.com/api/dcim/interfaces/8801/",
    "display": "ge-0",
    "device": {
        "id": 480,
        "url": "https://example.com/api/dcim/devices/480/",
        "display": "1000",
        "name": "1000",
        "display_name": "1000"
    },
    "name": "ge-0",
    "label": "",
    "type": {
        "value": "1000base-t",
        "label": "1000BASE-T (1GE)"
    },
    "enabled": true,
    "parent": null,
    "lag": null,
    "mtu": null,
    "mac_address": "AA:BB:CC:DD:EE:FF",
    "mgmt_only": false,
    "description": "",
    "mode": null,
    "untagged_vlan": null,
    "tagged_vlans": [],
    "mark_connected": false,
    "cable": {
        "id": 1548,
        "url": "https://example.com/api/dcim/cables/1548/",
        "display": "#1548",
        "label": ""
    },
    "cable_peer": {
        "id": 8277,
        "url": "https://example.com/api/dcim/interfaces/8277/",
        "display": "ge-0/0/0",
        "device": {
            "id": 472,
            "url": "https://example.com/api/dcim/devices/472/",
            "display": "juEX34-04",
            "name": "juEX34-04",
            "display_name": "juEX34-04"
        },
        "name": "ge-0/0/0",
        "cable": 1548,
        "_occupied": true
    },
    "cable_peer_type": "dcim.interface",
    "connected_endpoint": {
        "id": 8277,
        "url": "https://example.com/api/dcim/interfaces/8277/",
        "display": "ge-0/0/0",
        "device": {
            "id": 472,
            "url": "https://example.com/api/dcim/devices/472/",
            "display": "juEX34-04",
            "name": "juEX34-04",
            "display_name": "juEX34-04"
        },
        "name": "ge-0/0/0",
        "cable": 1548,
        "_occupied": true
    },
    "connected_endpoint_type": "dcim.interface",
    "connected_endpoint_reachable": true,
    "tags": [],
    "custom_fields": {},
    "created": "2021-04-23",
    "last_updated": "2021-04-23T10:21:19.028563Z",
    "count_ipaddresses": 0,
    "_occupied": true
}

I tested it for virtualization.interfaces and there it works as expected.

Should I file a new bug for this?

@jeremystretch
Copy link
Member

Yes, please open a new bug if there's specific, reproducible behavior that you believe is incorrect. Be sure to include the set of steps that someone else can take to replicate the suspected bug.

@jeremystretch jeremystretch removed the status: revisions needed This issue requires additional information to be actionable label Apr 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

2 participants