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 Platform Version as child model to Platform #3593

Closed
ReK42 opened this issue Oct 10, 2019 · 5 comments
Closed

Add Platform Version as child model to Platform #3593

ReK42 opened this issue Oct 10, 2019 · 5 comments

Comments

@ReK42
Copy link

ReK42 commented 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

@Grokzen
Copy link
Contributor

Grokzen commented 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.

@ReK42
Copy link
Author

ReK42 commented 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.

@jeremystretch
Copy link
Member

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.

@ReK42
Copy link
Author

ReK42 commented 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.

@jeremystretch
Copy link
Member

This can be done by combining filters:

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

@lock lock bot locked as resolved and limited conversation to collaborators Jan 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants