Ondřej Svoboda has uploaded a new change for review.
Change subject: testSetupNetworksAddDelDhcp: Check that an DHCPv4 address is in range ......................................................................
testSetupNetworksAddDelDhcp: Check that an DHCPv4 address is in range
(At least) one address is now required to be in a range we know and control. Also introduce range checking for IPv6.
Change-Id: Ied7e11e84b8f81c39c799fadfca06b7bde0a409c Signed-off-by: Ondřej Svoboda osvoboda@redhat.com --- M tests/functional/networkTests.py 1 file changed, 26 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/36186/1
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py index f23f033..c09e122 100644 --- a/tests/functional/networkTests.py +++ b/tests/functional/networkTests.py @@ -22,6 +22,8 @@ import json import signal import netaddr +import socket +import struct
from hookValidation import ValidatesHook from network.sourceroute import StaticSourceRoute @@ -217,6 +219,20 @@ del attrs['d']
+# adapted from http://stackoverflow.com/questions/10558441/ +# inet-aton-similar-function-for-ipv6 +def _ipv4_to_int(addr): + addr = addr.split('/')[0] # remove the network prefix + return struct.unpack('>L', socket.inet_aton(addr))[0] + + +def _ipv6_to_int(addr): + addr = addr.split('/')[0] # remove the network prefix + addr = socket.inet_pton(socket.AF_INET6, addr) + hi, lo = struct.unpack(">QQ", addr) + return (hi << 64) | lo + + @expandPermutations class NetworkTest(TestCaseBase):
@@ -367,6 +383,15 @@ def assertMtu(self, mtu, *elems): for elem in elems: self.assertEquals(int(mtu), int(self.vdsm_net.getMtu(elem))) + + def assertAddrInRange(self, addrs, family=4, + range_from=DHCP_RANGE_FROM, range_to=DHCP_RANGE_TO): + addr_to_int = _ipv4_to_int if family == 4 else _ipv6_to_int + range_from = addr_to_int(range_from) + range_to = addr_to_int(range_to) + passes = (range_from <= addr_to_int(a) <= range_to for a in addrs) + self.assertTrue(any(passes), 'no address {0} in expected range'.format( + addrs))
def testLegacyBonds(self): if not (caps.getos() in (caps.OSName.RHEVH, caps.OSName.RHEL) @@ -1773,6 +1798,7 @@ device_name = right
if dhcpv4: + self.assertAddrInRange(test_net['ipv4addrs']) # TODO: source routing not ready for IPv6 ip_addr = test_net['addr'] self.assertSourceRoutingConfiguration(device_name, ip_addr)
oVirt Jenkins CI Server has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that an DHCPv4 address is in range ......................................................................
Patch Set 1: Code-Review-1 Verified-1
Build Unstable
http://jenkins.ovirt.org/job/vdsm_master_network_functional_tests_gerrit/246... : The patch does not pass the network functional tests
oVirt Jenkins CI Server has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that a DHCPv4 address is in range ......................................................................
Patch Set 2: Code-Review-1 Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13514/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_network_functional_tests_gerrit/246... : The patch does not pass the network functional tests
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14471/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14303/ : SUCCESS
Ondřej Svoboda has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that a DHCPv4 address is in range ......................................................................
Patch Set 3: Verified+1
Another part of the test that just succeeds.
Ido Barkan has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that a DHCPv4 address is in range ......................................................................
Patch Set 3: Code-Review-1
(1 comment)
http://gerrit.ovirt.org/#/c/36186/3/tests/functional/networkTests.py File tests/functional/networkTests.py:
Line 390: addr_to_int = _ipv4_to_int if family == 4 else _ipv6_to_int Line 391: range_from = addr_to_int(range_from) Line 392: range_to = addr_to_int(range_to) Line 393: passes = (range_from <= addr_to_int(a) <= range_to for a in addrs) Line 394: self.assertTrue(any(passes), 'no address {0} in expected range'.format( please explain why any address is string enough for this assertion Line 395: addrs)) Line 396: Line 397: def testLegacyBonds(self): Line 398: if not (caps.getos() in (caps.OSName.RHEVH, caps.OSName.RHEL)
Ondřej Svoboda has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that a DHCPv4 address is in range ......................................................................
Patch Set 4:
(1 comment)
http://gerrit.ovirt.org/#/c/36186/4//COMMIT_MSG Commit Message:
Line 3: AuthorDate: 2014-12-15 17:37:17 +0100 Line 4: Commit: Ondřej Svoboda osvoboda@redhat.com Line 5: CommitDate: 2014-12-22 21:06:28 +0100 Line 6: Line 7: testSetupNetworksAddDelDhcp: Check that a DHCPv4 address is in range To be fair, the original intent was to prove DHCPv6 was working when we didn't have a DHCPv6 lease file "parser". It is only one more way to be sure. The patch is almost isolated so we can just leave it out. Line 8: Line 9: (At least) one address is now required to be in a range we know and control. Line 10: Also introduce range checking for IPv6. Line 11:
oVirt Jenkins CI Server has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Patch Set 3: -Code-Review -Verified
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13671/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14628/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14460/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Patch Set 4:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13686/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14643/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14475/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Patch Set 5:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13695/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14652/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14484/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Patch Set 6:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13699/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14656/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14488/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Patch Set 7:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13700/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14657/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14489/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Patch Set 8:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13706/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14663/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14495/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Patch Set 9:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13712/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14669/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14501/ : SUCCESS
Jenkins CI RO has abandoned this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Abandoned
Abandoned due to no activity - please restore if still relevant
Jenkins CI RO has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Patch Set 9:
Abandoned due to no activity - please restore if still relevant
automation@ovirt.org has posted comments on this change.
Change subject: testSetupNetworksAddDelDhcp: Check that addresses from DHCP are in range ......................................................................
Patch Set 9:
* Update tracker::IGNORE, no Bug-Url found
vdsm-patches@lists.fedorahosted.org