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

Service Port cannot be set to 0 #3725

Closed
kevinreniers opened this issue Dec 4, 2019 · 4 comments
Closed

Service Port cannot be set to 0 #3725

kevinreniers opened this issue Dec 4, 2019 · 4 comments
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@kevinreniers
Copy link

Environment

  • Python version: 3.7
  • NetBox version: 2.6.7

Steps to Reproduce

  1. Try to set the port of a device service to 0

Expected Behavior

Client-side validation seems to allow this because the min value is set to 0.

Snippet:

<input type="number" name="port" value="0" min="0" class="form-control" required="" placeholder="Port number" id="id_port">

Server-side validation seems to restrict this min value to 1.

We would like to use "0" as a way to model "All Ports".

Observed Behavior

Form reloads and nothing happens.
Entering -1 also generates a client-side validation "value should be greater than or equal to 0".

@ghost
Copy link

ghost commented Dec 5, 2019

Just out of interest, can you not resort to using a custom field instead of marking it as 0?

@kevinreniers
Copy link
Author

Definitely as a workaround. I would prefer to limit the use of custom fields to a bare minimum if we can model it using standard fields, though.

@jeremystretch
Copy link
Member

We would like to use "0" as a way to model "All Ports".

This would not be a valid use of this field. This field reflects a specific port number, thus zero is not a valid value.

This is a bug only so far that the client side validation for the field specifies the minimum value as zero rather than one.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application labels Dec 6, 2019
@kevinreniers
Copy link
Author

Thank you for the feedback. 😃

What would be your recommendation on modelling an F5 or Citrix virtual server that listens on all ports and is configured with 0 or *?

We have a few use cases like this that we would like to accurately and idiomatically use netbox as a source-of-truth for.

Since the port field is required, the recommendation of @ahmed-cader would not be entirely appropriate. Tagging, likewise, still forces an invalid value in the port field.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 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: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants