Petr Horáček has uploaded a new change for review.

Change subject: net test: shared nic between bond and network
......................................................................

net test: shared nic between bond and network

Change-Id: Ice4ead640d45d0717d2a30bd01398cbbfff3f88a
Signed-off-by: Petr Horáček <phora...@redhat.com>
---
M tests/network/func_net_bond_test.py
1 file changed, 31 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/06/64206/1

diff --git a/tests/network/func_net_bond_test.py 
b/tests/network/func_net_bond_test.py
index 0605396..e13140a 100644
--- a/tests/network/func_net_bond_test.py
+++ b/tests/network/func_net_bond_test.py
@@ -22,9 +22,10 @@
 
 from nose.plugins.attrib import attr
 
+from vdsm.network import errors as ne
 from vdsm.network.configurators.ifcfg import ifup, ifdown
 
-from .netfunctestlib import NetFuncTestCase, NOCHK
+from .netfunctestlib import NetFuncTestCase, SetupNetworksError, NOCHK
 from .nettestlib import dummy_device
 
 NETWORK1_NAME = 'test-network1'
@@ -56,6 +57,35 @@
 
                 self.assertBond(BOND_NAME, BONDCREATE[BOND_NAME])
 
+    def test_add_the_same_nic_to_net_and_bond(self):
+        with dummy_device() as nic:
+            NETCREATE = {NETWORK1_NAME: {'nic': nic, 'switch': self.switch}}
+            BONDCREATE = {BOND_NAME: {'nics': [nic], 'switch': self.switch}}
+
+            with self.assertRaises(SetupNetworksError) as e:
+                self.setupNetworks(NETCREATE, BONDCREATE, NOCHK)
+            self.assertEqual(e.exception.status, ne.ERR_USED_NIC)
+
+    def test_attach_nic_attached_to_a_network_to_a_bond(self):
+        with dummy_device() as nic:
+            NETCREATE = {NETWORK1_NAME: {'nic': nic, 'switch': self.switch}}
+            BONDCREATE = {BOND_NAME: {'nics': [nic], 'switch': self.switch}}
+
+            with self.setupNetworks(NETCREATE, {}, NOCHK):
+                with self.assertRaises(SetupNetworksError) as e:
+                    self.setupNetworks({}, BONDCREATE, NOCHK)
+                self.assertEqual(e.exception.status, ne.ERR_USED_NIC)
+
+    def test_attach_nic_attached_to_a_bond_to_a_network(self):
+        with dummy_device() as nic:
+            NETCREATE = {NETWORK1_NAME: {'nic': nic, 'switch': self.switch}}
+            BONDCREATE = {BOND_NAME: {'nics': [nic], 'switch': self.switch}}
+
+            with self.setupNetworks({}, BONDCREATE, NOCHK):
+                with self.assertRaises(SetupNetworksError) as e:
+                    self.setupNetworks(NETCREATE, {}, NOCHK)
+                self.assertEqual(e.exception.status, ne.ERR_USED_NIC)
+
 
 @attr(type='functional', switch='legacy')
 class BondBasicLegacyTest(BondBasicTemplate):


-- 
To view, visit https://gerrit.ovirt.org/64206
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice4ead640d45d0717d2a30bd01398cbbfff3f88a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phora...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to