diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-06-10 18:09:29 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-06-10 18:09:29 +0000 |
commit | 98e24bedf35231431da6924ce7eee05b8a7cbec1 (patch) | |
tree | b370fb650f1e2cffcd978858df2289b3a796cfeb | |
parent | 6439ee0ab5ad876e664d77286d64b1da82fc0b00 (diff) | |
parent | 9598077a85568b5771e331e637d363f0463646c6 (diff) | |
download | oslo-utils-98e24bedf35231431da6924ce7eee05b8a7cbec1.tar.gz |
Merge "Allow assigning "0" to port"3.13.0
-rw-r--r-- | oslo_utils/netutils.py | 4 | ||||
-rw-r--r-- | oslo_utils/tests/test_netutils.py | 4 | ||||
-rw-r--r-- | releasenotes/notes/bump-up-port-range-f774a16336158339.yaml | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/oslo_utils/netutils.py b/oslo_utils/netutils.py index b639f3f..7e14d57 100644 --- a/oslo_utils/netutils.py +++ b/oslo_utils/netutils.py @@ -222,12 +222,12 @@ def _is_int_in_range(value, start, end): def is_valid_port(port): """Verify that port represents a valid port number. - Port can be valid integer having a value of 1 up to and + Port can be valid integer having a value of 0 up to and including 65535. .. versionadded:: 1.1.1 """ - return _is_int_in_range(port, 1, 65535) + return _is_int_in_range(port, 0, 65535) def is_valid_icmp_type(type): diff --git a/oslo_utils/tests/test_netutils.py b/oslo_utils/tests/test_netutils.py index 9b15d61..823c502 100644 --- a/oslo_utils/tests/test_netutils.py +++ b/oslo_utils/tests/test_netutils.py @@ -193,13 +193,13 @@ class NetworkUtilsTest(test_base.BaseTestCase): self.assertFalse(netutils.is_valid_cidr(10)) def test_valid_port(self): - valid_inputs = [1, '1', 2, '3', '5', 8, 13, 21, + valid_inputs = [0, '0', 1, '1', 2, '3', '5', 8, 13, 21, '80', '3246', '65535'] for input_str in valid_inputs: self.assertTrue(netutils.is_valid_port(input_str)) def test_valid_port_fail(self): - invalid_inputs = ['-32768', '0', 0, '65536', 528491, '528491', + invalid_inputs = ['-32768', '65536', 528491, '528491', '528.491', 'thirty-seven', None] for input_str in invalid_inputs: self.assertFalse(netutils.is_valid_port(input_str)) diff --git a/releasenotes/notes/bump-up-port-range-f774a16336158339.yaml b/releasenotes/notes/bump-up-port-range-f774a16336158339.yaml new file mode 100644 index 0000000..5e7e9aa --- /dev/null +++ b/releasenotes/notes/bump-up-port-range-f774a16336158339.yaml @@ -0,0 +1,3 @@ +--- +fixes: + - Expanded range of allowed ports by adding 0 to valid number. |