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

"Devices" list shows only one primary IP if device has both primary v4/v6 #862

Closed
candlerb opened this issue Jan 31, 2017 · 4 comments
Closed
Labels
type: feature Introduction of new functionality to the application

Comments

@candlerb
Copy link
Contributor

  • Create a device with one interface
  • Add a IPv4 and IPv6 to that interface, marking them both as "Primary"
  • Search for it by name
  • In the resulting table, the right hand column is "IP Address" but it shows only one address (I am seeing the IPv6 one)

I think that ideally it would show the primary IPv4 and IPv6 addresses one below the other in the same table column.

@jeremystretch
Copy link
Member

The Device model has a convenience property named primary_ip which returns either the primary v6 IP or the primary v4 IP (or None):

    @property
    def primary_ip(self):
        if settings.PREFER_IPV4 and self.primary_ip4:
            return self.primary_ip4
        elif self.primary_ip6:
            return self.primary_ip6
        elif self.primary_ip4:
            return self.primary_ip4
        else:
            return None

We can include both IPs, but doing so would remove the option to enable sorting devices by IP address. (This isn't currently available, but could be.)

@candlerb
Copy link
Contributor Author

candlerb commented Jan 31, 2017

Idea: have a new property which returns IPv6<br/>IPv4 or IPv4<br/>IPv6 (depending on the PREFER_IPV4 setting). Then could you sort on that?

Sorry - ignore stupid idea. Addresses don't sort as strings.

@candlerb
Copy link
Contributor Author

Personally I'm fine with not being able to sort in this view. However:

Simple solution: have separate columns for primary v4 and primary v6.

The downside is that people may need to buy larger monitors - annoying for people who aren't using v6. But I think there's a separate ticket for being able to customise the columns displayed.

Complex solution: have a property which returns a compound value like [ipv4, ipv6] which is sortable, and can be rendered appropriately.

@jeremystretch
Copy link
Member

Eh, IMO sorting devices by primary IP isn't needed. One can always do that via the IP address list if needed anyway. I think listing the IPv6 and/or IPv4 primaries in the same column makes sense.

@jeremystretch jeremystretch added the type: feature Introduction of new functionality to the application label Jan 31, 2017
lampwins pushed a commit to lampwins/netbox that referenced this issue Oct 13, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2020
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