Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
gerrit-hooks has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 8: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 8 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Ondřej Svoboda Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
gerrit-hooks has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 7: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Ondřej Svoboda Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
Ondřej Svoboda has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 6: "Error: Could not create NMClient object: Could not connect: No such file or directory" may be due to chroot environment. I haven't seen this on my host. -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Ondřej Svoboda Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
gerrit-hooks has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 6: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
gerrit-hooks has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 5: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
gerrit-hooks has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 4: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
Dan Kenigsberg has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 3: Code-Review-1 need to add nmcli to *.packages -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
gerrit-hooks has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 3: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
gerrit-hooks has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 2: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
Ondřej Svoboda has uploaded a new change for review. Change subject: tests: introduce the networkmanager module, with an integration test .. tests: introduce the networkmanager module, with an integration test Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Signed-off-by: Ondřej Svoboda --- M tests/network/Makefile.am M tests/network/nettestlib.py A tests/network/networkmanager.py A tests/network/networkmanager_test.py 4 files changed, 216 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/57062/1 diff --git a/tests/network/Makefile.am b/tests/network/Makefile.am index 9d4f7a8..6476d9d 100644 --- a/tests/network/Makefile.am +++ b/tests/network/Makefile.am @@ -25,6 +25,7 @@ *_test.py \ dhcp.py \ firewall.py \ + networkmanager.py \ nettestlib.py \ $(NULL) diff --git a/tests/network/nettestlib.py b/tests/network/nettestlib.py index 465c354..0881302 100644 --- a/tests/network/nettestlib.py +++ b/tests/network/nettestlib.py @@ -41,6 +41,7 @@ from . import dhcp from . import firewall +from . import networkmanager EXT_IP = "/sbin/ip" _IPERF3_BINARY = CommandPath('iperf3', '/usr/bin/iperf3') @@ -443,3 +444,42 @@ '/'.join(str(family) for family in families))) else: raise + + +@contextmanager +def nm_controlled_bond(bond_name, bond_mode=None, miimon=None, + ipv4_address=None, ipv4_gateway=None, + dhcp_server_ipv4=None, dhcp_server_ipv4_cidr=None, + dhcp_range_from=None, dhcp_range_to=None): +with veth_pair() as (remote1, local1), veth_pair() as (remote2, local2): +router_ports = [remote1, remote2] +local_nics_to_enslave = [local1, local2] + +if dhcp_server_ipv4 and dhcp_server_ipv4_cidr: +for port in router_ports: +addrAdd(port, dhcp_server_ipv4, dhcp_server_ipv4_cidr) +linkSet(port, ['up']) + +if dhcp_range_from and dhcp_range_to: +with dnsmasq_run(router_ports, dhcp_range_from, dhcp_range_to, + router=ipv4_gateway): +with wait_for_address(bond_name, families=(4,), timeout=10): +try: +with networkmanager.connection( +device_name=bond_name, conn_type='bond', +slaves=local_nics_to_enslave, +bond_mode=bond_mode, +miimon=miimon) as conn_name: +yield conn_name, local_nics_to_enslave +except networkmanager.NetworkManagerError as e: +raise SkipTest(e.message) +else: +try: +with networkmanager.connection( +device_name=bond_name, conn_type='bond', +slaves=local_nics_to_enslave, bond_mode=bond_mode, +miimon=miimon, ipv4_address=ipv4_address, +ipv4_gateway=ipv4_gateway, dhcpv4=False) as conn_name: +yield conn_name, local_nics_to_enslave +except networkmanager.NetworkManagerError as e: +raise SkipTest(e.message) diff --git a/tests/network/networkmanager.py b/tests/network/networkmanager.py new file mode 100644 index 000..0a575cc --- /dev/null +++ b/tests/network/networkmanager.py @@ -0,0 +1,131 @@ +# Copyright 2016 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Refer to the README and COPYING files for full details of the license +# + +from __future__ import absolute_import +from contextlib import contextmanager +import logging + +import six + +from vdsm.commands import execCmd +from vdsm.utils import CommandPath + +_NMCLI = CommandPath('nmcli', '/usr/bin/nmcli') + + +class NetworkManagerError(RuntimeError): +pass + + +def connection_add(device_name, conn_type, conn_name=None, autoconnect=None, + persistent=None, master=None, bond_mode=None, miimon=None, + ipv4_address=None, ipv4_gateway=None): +nmcli_command = [_NMCLI.cmd, '--terse', 'connection', 'add', +
Change in vdsm[master]: tests: introduce the networkmanager module, with an integrat...
gerrit-hooks has posted comments on this change. Change subject: tests: introduce the networkmanager module, with an integration test .. Patch Set 1: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/57062 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id83fa34f9ca7ca910f705e5c360ad420c7a0dcfc Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ondřej Svoboda Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches