Skip to content

Instantly share code, notes, and snippets.

@jathanism
Created April 13, 2021 22:35
Show Gist options
  • Save jathanism/f15e29a528cd01d865c58b08ab64b994 to your computer and use it in GitHub Desktop.
Save jathanism/f15e29a528cd01d865c58b08ab64b994 to your computer and use it in GitHub Desktop.
From 19e3203ea649a2668629eb66088f004a8747248c Mon Sep 17 00:00:00 2001
From: jathanism <[email protected]>
Date: Tue, 13 Apr 2021 15:34:02 -0700
Subject: [PATCH] Patch for IPv6 ending in non-integer (a-f)
---
nautobot/ipam/querysets.py | 2 +-
nautobot/ipam/tests/test_querysets.py | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/nautobot/ipam/querysets.py b/nautobot/ipam/querysets.py
index d347b6d8..445ff1f2 100644
--- a/nautobot/ipam/querysets.py
+++ b/nautobot/ipam/querysets.py
@@ -251,7 +251,7 @@ class IPAddressQuerySet(RestrictedQuerySet):
hextets = value.split(":")
# Before we normalize, check that final value is a digit.
- if hextets[-1].isdigit():
+ if hextets[-1].alnum():
fill_zeroes = False # Leave "" in there.
prefix_len = 128 # Force /128
else:
diff --git a/nautobot/ipam/tests/test_querysets.py b/nautobot/ipam/tests/test_querysets.py
index 8164c98c..bf6f14c5 100644
--- a/nautobot/ipam/tests/test_querysets.py
+++ b/nautobot/ipam/tests/test_querysets.py
@@ -137,6 +137,7 @@ class IPAddressQuerySet(TestCase):
"fe80": "fe80::/16",
"fe80::": "fe80::/16",
"fe80::46b:a212:1132:3615": "fe80::46b:a212:1132:3615/128",
+ "fe80::76:88e9:12aa:334d": "fe80::76:88e9:12aa:334d/128",
}
for test, expected in tests.items():
--
2.30.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment