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

Primary IPv6 for VDC filters IPv4 #10950

Closed
abhi1693 opened this issue Nov 17, 2022 · 2 comments
Closed

Primary IPv6 for VDC filters IPv4 #10950

abhi1693 opened this issue Nov 17, 2022 · 2 comments
Assignees
Labels
beta Concerns a bug/feature in a beta release status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@abhi1693
Copy link
Member

NetBox version

v3.4-beta1

Python version

3.10

Steps to Reproduce

  1. Click on Add on the VDC page
  2. Choose ncsu-coreswitch1 on the device drop-down
  3. Click on Primary IPv6 dropdown

Expected Behavior

Only IPv6 addresses should be displayed

Observed Behavior

IPv4 addresses are displayed
image

@abhi1693 abhi1693 added the type: bug A confirmed report of unexpected behavior in the application label Nov 17, 2022
@kkthxbye-code
Copy link
Contributor

For context it's missing something equivalent to this logic (example for devices):

for family in [4, 6]:
ip_choices = [(None, '---------')]
# Gather PKs of all interfaces belonging to this Device or a peer VirtualChassis member
interface_ids = self.instance.vc_interfaces(if_master=False).values_list('pk', flat=True)
# Collect interface IPs
interface_ips = IPAddress.objects.filter(
address__family=family,
assigned_object_type=ContentType.objects.get_for_model(Interface),
assigned_object_id__in=interface_ids
).prefetch_related('assigned_object')
if interface_ips:
ip_list = [(ip.id, f'{ip.address} ({ip.assigned_object})') for ip in interface_ips]
ip_choices.append(('Interface IPs', ip_list))
# Collect NAT IPs
nat_ips = IPAddress.objects.prefetch_related('nat_inside').filter(
address__family=family,
nat_inside__assigned_object_type=ContentType.objects.get_for_model(Interface),
nat_inside__assigned_object_id__in=interface_ids
).prefetch_related('assigned_object')
if nat_ips:
ip_list = [(ip.id, f'{ip.address} (NAT)') for ip in nat_ips]
ip_choices.append(('NAT IPs', ip_list))
self.fields['primary_ip{}'.format(family)].choices = ip_choices

@kkthxbye-code kkthxbye-code added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation beta Concerns a bug/feature in a beta release labels Nov 17, 2022
@DanSheps DanSheps added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Nov 17, 2022
@DanSheps DanSheps self-assigned this Nov 17, 2022
@DanSheps
Copy link
Member

DanSheps commented Nov 17, 2022

For context it's missing something equivalent to this logic (example for devices):

I think we can get away with just simple filters on this one as I don't think we care about NAT since this would be for management. TBH I am not sure why we care about nat_inside for regular devices either, seems unneeded to me but I am sure there is a use case somewhere (nat'd IP for a remote site or something)

Maybe it would make sense for a "available_on_device" filter similar to the one on vlans.

@jeremystretch jeremystretch self-assigned this Dec 9, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beta Concerns a bug/feature in a beta release status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
4 participants