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

Improve interfaces templates: allow word expansion #3623

Closed
fser opened this issue Oct 18, 2019 · 5 comments · Fixed by #3865
Closed

Improve interfaces templates: allow word expansion #3623

fser opened this issue Oct 18, 2019 · 5 comments · Fixed by #3865
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@fser
Copy link

fser commented Oct 18, 2019

Environment

  • Python version: 3.7
  • NetBox version: 2.6.6

Proposed Functionality

In the template interface, allow user to expand names. For example Interface/[FRONT|BACK]/Eth[1-10] would produce:

Interface/FRONT/Eth1
Interface/FRONT/Eth2
Interface/FRONT/Eth3
Interface/FRONT/Eth4
Interface/FRONT/Eth5
Interface/FRONT/Eth6
Interface/FRONT/Eth7
Interface/FRONT/Eth8
Interface/FRONT/Eth9
Interface/FRONT/Eth10
Interface/BACK/Eth1
Interface/BACK/Eth2
Interface/BACK/Eth3
Interface/BACK/Eth4
Interface/BACK/Eth5
Interface/BACK/Eth6
Interface/BACK/Eth7
Interface/BACK/Eth8
Interface/BACK/Eth9
Interface/BACK/Eth10

Use Case

We need such expansion pattern for our device templates. Maybe others do as well!

Database Changes

None

External Dependencies

None

@kobayashi
Copy link
Contributor

Thank you for opening this issue.
Could you let me know what kind of devices have both front/back interface?

@fser
Copy link
Author

fser commented Oct 21, 2019

Hello,

from my understanding, mostly patch panels.

@DanSheps
Copy link
Member

Are you using interfaces or front/rear ports?

@jeremystretch
Copy link
Member

Two thoughts. First, we should stick to comma-delimited values since that's the current convention. Second, we should be able to tweak parse_alphanumeric_range() to simply ignore values which don't specify a range and pass them through.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application labels Oct 23, 2019
@fser
Copy link
Author

fser commented Oct 24, 2019

Sorry for the delay!
@DanSheps : I asked my colleague, and he told me he uses interfaces because the "front/back" thing didn't exist at the time when they created the template. Does that answer your question?

@jeremystretch : I tried to tweak it using commas (by the way, why does the regex allow so many delimiter [?:,-] if only the coma is valid?) but I couldn't identify the case where expansion was required instead of enumeration. See my PR if that can be relevant.

Thanks anyway for the interest!

jeremystretch added a commit that referenced this issue Jan 10, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
4 participants