Add Platform Version as child model to Platform #2944

Closed
opened 2025-12-29 18:23:50 +01:00 by adam · 5 comments
Owner

Originally created by @ReK42 on GitHub (Oct 10, 2019).

Environment

  • Python version: 3.6.8
  • NetBox version: 2.6.5

Proposed Functionality

Add a child model to Platform named Platform Version. Devices could then select either the platform in general or a specific version of it. If the version-specific fields, such as NAPALM driver and arguments, are null they should inherit the values on the base platform, otherwise they should override them.

Use Case

Platforms can include major version changes that significantly affect functionality and feature set, or even the NAPALM driver required to access them (e.g. Cisco NX-OS prior to version 6.1 requires using nxos_ssh instead of nxos).

This would also add the ability to track major version changes and use that to aid in lifecycle management. This should not extend into minor version tracking and patch targeting, as that is very vendor-specific and can be accomplished through other means, such as an OS version field on the device.

For example, virtual machines could have the following platforms:

  • CentOS
    • CentOS 6
    • CentOS 7
    • CentOS 8
  • Windows Server
    • Windows Server 2012
    • Windows Server 2012 R2
    • Windows Server 2016
    • Windows Server 2019

Database Changes

Add a new model, PlatformVersion, with a foreign key to Platform.

External Dependencies

None

Originally created by @ReK42 on GitHub (Oct 10, 2019). ### Environment * Python version: 3.6.8 * NetBox version: 2.6.5 ### Proposed Functionality Add a child model to Platform named Platform Version. Devices could then select either the platform in general or a specific version of it. If the version-specific fields, such as NAPALM driver and arguments, are null they should inherit the values on the base platform, otherwise they should override them. ### Use Case Platforms can include major version changes that significantly affect functionality and feature set, or even the NAPALM driver required to access them (e.g. Cisco NX-OS prior to version 6.1 requires using nxos_ssh instead of nxos). This would also add the ability to track major version changes and use that to aid in lifecycle management. This should not extend into minor version tracking and patch targeting, as that is very vendor-specific and can be accomplished through other means, such as an OS version field on the device. For example, virtual machines could have the following platforms: - CentOS - CentOS 6 - CentOS 7 - CentOS 8 - Windows Server - Windows Server 2012 - Windows Server 2012 R2 - Windows Server 2016 - Windows Server 2019 ### Database Changes Add a new model, PlatformVersion, with a foreign key to Platform. ### External Dependencies None
adam closed this issue 2025-12-29 18:23:50 +01:00
Author
Owner

@Grokzen commented on GitHub (Oct 11, 2019):

would all current platform relations have to be migrated to the new PlatformVersion object instances? And would all current relations that is in the code point to this new object? I dont know if you would really point to the old Platform any longer then since if you have to choose between Platform and PlatformVersion it would make the code much more messier. Alternative solution might be to make Platform model a Tree model then you can make any tree relation that you want and you still keep the Platform model and dont have to change any code that enables us to point to a Platform object.

@Grokzen commented on GitHub (Oct 11, 2019): would all current platform relations have to be migrated to the new PlatformVersion object instances? And would all current relations that is in the code point to this new object? I dont know if you would really point to the old Platform any longer then since if you have to choose between Platform and PlatformVersion it would make the code much more messier. Alternative solution might be to make Platform model a Tree model then you can make any tree relation that you want and you still keep the Platform model and dont have to change any code that enables us to point to a Platform object.
Author
Owner

@ReK42 commented on GitHub (Oct 11, 2019):

You're right, it would be easier to have devices link to a single model rather than two possible ones, but since this is a simple one-level hierarchy you could do that by simply creating a hidden PlatformVersion instance with the same properties as the Platform.

@ReK42 commented on GitHub (Oct 11, 2019): You're right, it would be easier to have devices link to a single model rather than two possible ones, but since this is a simple one-level hierarchy you could do that by simply creating a hidden PlatformVersion instance with the same properties as the Platform.
Author
Owner

@jeremystretch commented on GitHub (Oct 15, 2019):

This has been raised before and the solution is to simply include the version number in the platform name. So instead of having a hierarchy with CentOS and Windows Server at its root, you would have a flat list:

  • CentOS 6
  • CentOS 7
  • CentOS 8
  • Windows Server 2012
  • Windows Server 2012 R2
  • Windows Server 2016
  • Windows Server 2019

This should be acceptable as the total number of major versions is likely to be relatively low. And if you need to track specific versions down to the minor/patch level, a custom field is probably more efficient anyway.

@jeremystretch commented on GitHub (Oct 15, 2019): This has been raised before and the solution is to simply include the version number in the platform name. So instead of having a hierarchy with CentOS and Windows Server at its root, you would have a flat list: - CentOS 6 - CentOS 7 - CentOS 8 - Windows Server 2012 - Windows Server 2012 R2 - Windows Server 2016 - Windows Server 2019 This should be acceptable as the total number of major versions is likely to be relatively low. And if you need to track specific versions down to the minor/patch level, a custom field is probably more efficient anyway.
Author
Owner

@ReK42 commented on GitHub (Oct 15, 2019):

The intention behind having the hierarchy is so that entries can still be aggregated and displayed together despite being separate major versions. That way a user could go to /dcim/devices/?platform=cisco-ios and see both IOS 12 and IOS 15 devices, for example.

@ReK42 commented on GitHub (Oct 15, 2019): The intention behind having the hierarchy is so that entries can still be aggregated and displayed together despite being separate major versions. That way a user could go to /dcim/devices/?platform=cisco-ios and see both IOS 12 and IOS 15 devices, for example.
Author
Owner

@jeremystretch commented on GitHub (Oct 15, 2019):

This can be done by combining filters:

GET /api/dcim/devices/?platform=cisco-ios-12&platform=cisco-ios-15

@jeremystretch commented on GitHub (Oct 15, 2019): This can be done by combining filters: `GET /api/dcim/devices/?platform=cisco-ios-12&platform=cisco-ios-15`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2944