Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
20d582ae93
!32 [sync] PR-29: Add hash capabilities to OUI
From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-11-29 09:29:14 +00:00
liubo
febe789902 Add hash capabilities to OUI
Signed-off-by: liubo <liubo1@xfusion.com>
(cherry picked from commit 86d780326749cf2d1ddf4eadbec8623e93312076)
2023-11-29 14:11:23 +08:00
openeuler-ci-bot
e5f3f588d4
!25 [sync] PR-21: delete taboo words
From: @openeuler-sync-bot 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
2023-06-21 03:05:08 +00:00
zhangpan
7424a274bc delete taboo words
(cherry picked from commit f6bc8d0fec43e6c95ec638a41d404f6f8af9d918)
2023-06-21 09:49:47 +08:00
openeuler-ci-bot
0b8f98576d
!17 Fix for is_loopback behaviour (issue: #222)
From: @cao-fei8 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2023-01-18 09:34:29 +00:00
cao-fei8
a3f14ba2a2 Fix for is_loopback behaviour (issue: #222)
Reference:
606a44b62e

Signed-off-by: cao-fei8 <caofei@xfusion.com>
2023-01-16 19:34:19 +08:00
openeuler-ci-bot
7205ac8dc9
!12 [sync] PR-11: License compliance rectification
From: @openeuler-sync-bot 
Reviewed-by: @ruebb 
Signed-off-by: @ruebb
2022-10-27 07:27:06 +00:00
wu-leilei
cb26fa48ad License compliance rectification
(cherry picked from commit 7264d6affe6a7e1c2afd3e7817ecae008f90d7b1)
2022-10-21 11:10:56 +08:00
openeuler-ci-bot
b770940eae
!10 [sync] PR-8: enable testcase
From: @openeuler-sync-bot 
Reviewed-by: @orange-snn 
Signed-off-by: @orange-snn
2022-03-28 03:09:16 +00:00
shirely16
45ff338224 enable testcase
(cherry picked from commit aa6d73045a56c2fe996da3e206be434831bb6ced)
2022-03-26 18:18:36 +08:00
4 changed files with 201 additions and 3 deletions

View File

@ -0,0 +1,47 @@
From b6c4203f85dba18074971208c0602c5bada90e8b Mon Sep 17 00:00:00 2001
From: amitmi704 <36094800+amitmi704@users.noreply.github.com>
Date: Sun, 7 Feb 2021 18:54:27 -0600
Subject: [PATCH] Add hash capabilities to OUI (#225)
Closes #224
---
netaddr/eui/__init__.py | 3 +++
netaddr/tests/eui/test_eui.py | 8 ++++++++
2 files changed, 11 insertions(+)
diff --git a/netaddr/eui/__init__.py b/netaddr/eui/__init__.py
index 5639676..07bbdc3 100644
--- a/netaddr/eui/__init__.py
+++ b/netaddr/eui/__init__.py
@@ -100,6 +100,9 @@ class OUI(BaseIdentifier):
else:
raise NotRegisteredError('OUI %r not registered!' % (oui,))
+ def __hash__(self):
+ return hash(self._value)
+
def __eq__(self, other):
if not isinstance(other, OUI):
try:
diff --git a/netaddr/tests/eui/test_eui.py b/netaddr/tests/eui/test_eui.py
index 645a518..c17d0ce 100644
--- a/netaddr/tests/eui/test_eui.py
+++ b/netaddr/tests/eui/test_eui.py
@@ -186,6 +186,14 @@ def test_oui_constructor():
assert oui.reg_count == 3
+def test_oui_hash():
+ oui0 = OUI(0)
+ oui1 = OUI(1)
+ oui_dict = {oui0: None, oui1: None}
+
+ assert list(oui_dict.keys()) == [OUI(0), OUI(1)]
+
+
def test_eui_iab():
mac = EUI('00-50-C2-00-0F-01')
assert mac.is_iab()
--
2.42.0.windows.2

View File

@ -0,0 +1,68 @@
From 606a44b62ea7032f63e359aaaaabc0057e168890 Mon Sep 17 00:00:00 2001
From: niels <nkeulen@gmail.com>
Date: Wed, 27 Jan 2021 20:44:12 +0100
Subject: [PATCH] Fix for is_loopback behaviour (issue: #222) (#223)
---
netaddr/ip/__init__.py | 4 +--
.../tests/ip/test_ip_network_categories.py | 26 +++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
create mode 100644 netaddr/tests/ip/test_ip_network_categories.py
diff --git a/netaddr/ip/__init__.py b/netaddr/ip/__init__.py
index d1232eb..9e13b29 100644
--- a/netaddr/ip/__init__.py
+++ b/netaddr/ip/__init__.py
@@ -151,7 +151,7 @@ class BaseIP(object):
if self._module.version == 4:
return self in IPV4_LOOPBACK
elif self._module.version == 6:
- return self == IPV6_LOOPBACK
+ return self in IPV6_LOOPBACK
def is_private(self):
"""
@@ -1949,7 +1949,7 @@ IPV4_RESERVED = (
#-----------------------------------------------------------------------------
# Cached IPv6 address range lookups.
#-----------------------------------------------------------------------------
-IPV6_LOOPBACK = IPAddress('::1')
+IPV6_LOOPBACK = IPNetwork('::1/128')
IPV6_PRIVATE = (
IPNetwork('fc00::/7'), # Unique Local Addresses (ULA)
diff --git a/netaddr/tests/ip/test_ip_network_categories.py b/netaddr/tests/ip/test_ip_network_categories.py
new file mode 100644
index 0000000..9f9961e
--- /dev/null
+++ b/netaddr/tests/ip/test_ip_network_categories.py
@@ -0,0 +1,26 @@
+from netaddr import IPNetwork
+
+
+def test_is_unicast():
+ assert IPNetwork('192.0.2.0/24').is_unicast()
+ assert IPNetwork('fe80::1/48').is_unicast()
+
+
+def test_is_multicast():
+ assert IPNetwork('239.192.0.1/24').is_multicast()
+ assert IPNetwork('ff00::/8').is_multicast()
+
+
+def test_is_private():
+ assert IPNetwork('10.0.0.0/24').is_private()
+ assert IPNetwork('fc00::/7').is_private()
+
+
+def test_is_reserved():
+ assert IPNetwork('240.0.0.0/24').is_reserved()
+ assert IPNetwork('0::/48').is_reserved()
+
+
+def test_is_loopback():
+ assert IPNetwork('127.0.0.0/8').is_loopback()
+ assert IPNetwork('::1/128').is_loopback()
--
2.33.0

View File

@ -0,0 +1,64 @@
From 76fe3af427a1316a91c96e01de1f0407893121a9 Mon Sep 17 00:00:00 2001
From: hanhui <hanhui15@h-partners.com>
Date: Sat, 26 Mar 2022 16:23:45 +0800
Subject: [PATCH] disable-test-oui-information
reason:elimate-ROC-in-python-netaddr.patch lead to
oui.registration.org and oui.registration.address
changed,cause the failure of test cases.
Therefore, disable the test code
---
netaddr/tests/eui/test_eui.py | 27 ---------------------------
1 file changed, 27 deletions(-)
diff --git a/netaddr/tests/eui/test_eui.py b/netaddr/tests/eui/test_eui.py
index 645a518..b8dcedd 100644
--- a/netaddr/tests/eui/test_eui.py
+++ b/netaddr/tests/eui/test_eui.py
@@ -146,42 +146,15 @@ def test_eui_oui_information():
oui = mac.oui
assert str(oui) == '00-1B-77'
- assert oui.registration().address == [
- 'Lot 8, Jalan Hi-Tech 2/3',
- 'Kulim Kedah 09000',
- 'MY'
- ]
-
- assert oui.registration().org == 'Intel Corporate'
-
-
def test_oui_constructor():
oui = OUI(524336)
assert str(oui) == '08-00-30'
assert oui == OUI('08-00-30')
- assert oui.registration(0).address == [
- '2380 N. ROSE AVENUE',
- 'OXNARD CA 93010',
- 'US'
- ]
- assert oui.registration(0).org == 'NETWORK RESEARCH CORPORATION'
assert oui.registration(0).oui == '08-00-30'
- assert oui.registration(1).address == [
- 'GPO BOX 2476V',
- 'MELBOURNE VIC 3001',
- 'AU',
- ]
- assert oui.registration(1).org == 'ROYAL MELBOURNE INST OF TECH'
assert oui.registration(1).oui == '08-00-30'
- assert oui.registration(2).address == [
- 'CH-1211',
- 'GENEVE SUISSE/SWITZ 023',
- 'CH'
- ]
- assert oui.registration(2).org == 'CERN'
assert oui.registration(2).oui == '08-00-30'
assert oui.reg_count == 3
--
2.33.0

View File

@ -1,13 +1,16 @@
Name: python-netaddr Name: python-netaddr
Version: 0.8.0 Version: 0.8.0
Release: 2 Release: 7
Summary: A pure Python network address representation and manipulation library Summary: A pure Python network address representation and manipulation library
License: BSD License: BSD-3-Clause
URL: http://github.com/drkjam/netaddr URL: http://github.com/drkjam/netaddr
Source0: https://pypi.python.org/packages/source/n/netaddr/netaddr-%{version}.tar.gz Source0: https://pypi.python.org/packages/source/n/netaddr/netaddr-%{version}.tar.gz
Patch9000: elimate-ROC-in-python-netaddr.patch Patch9000: elimate-ROC-in-python-netaddr.patch
Patch9001: disable-test-oui-information.patch
Patch9002: 0001-Fix-for-is_loopback-behaviour-issue-222-223.patch
Patch9003: 0001-Add-hash-capabilities-to-OUI-225.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python3-devel python3-setuptools python3-sphinx python3-pytest BuildRequires: python3-devel python3-setuptools python3-sphinx python3-pytest
@ -46,15 +49,31 @@ PYTHONPATH='../' sphinx-build-%{python3_version} -b html -d build/doctrees sourc
%py3_install %py3_install
%check %check
%{__python3} setup.py test py.test-%{python3_version}
%files -n python3-netaddr %files -n python3-netaddr
%exclude %{python3_sitelib}/netaddr/eui/oui.txt
%license COPYRIGHT %license COPYRIGHT
%doc AUTHORS CHANGELOG README.rst docs/python3/html %doc AUTHORS CHANGELOG README.rst docs/python3/html
%{python3_sitelib}/* %{python3_sitelib}/*
%{_bindir}/netaddr %{_bindir}/netaddr
%changelog %changelog
* Tue Nov 14 2023 liubo <liubo1@xfusion.com> - 0.8.0-7
- Add hash capabilities to OUI
* Tue Jun 13 2023 zhangpan <zhangpan103@h-partners.com> - 0.8.0-6
- delete taboo words
* Tue Jan 17 2023 caofei <caofei@xfusion.com> - 0.8.0-5
- Fix for is_loopback behaviour (issue: #222)
* Wed May 11 2022 wulei <wulei80@h-partners.com> - 0.8.0-4
- License compliance rectification
* Sat Mar 26 2022 hanhui <hanhui15@h-partners.com> - 0.8.0-3
- enable testcase
* Mon Jan 17 2022 xingxing <xingxing9@huawei.com> - 0.8.0-2 * Mon Jan 17 2022 xingxing <xingxing9@huawei.com> - 0.8.0-2
- delete more sensitive keyword - delete more sensitive keyword