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

Change subject: net: tests: test if setupNetworks drops/keeps initial nics IP
......................................................................

net: tests: test if setupNetworks drops/keeps initial nics IP

When we create a network over a nic, nics initial IP configuration
is dropped because of we rewrite its ifcfg file.

When we create a bond over a nic, nics initial IP configuration is
kept.

This patch introduces two new tests which make sure about that and
could be used for test-driven developement of other configurators
and OVS hook.

Signed-off-by: Petr Horáček <[email protected]>
Change-Id: I53068584d873b9349914262341e2a0a8cf4a4461
---
M tests/functional/networkTests.py
1 file changed, 37 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/46690/1

diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index cddf49f..4751d60 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -32,7 +32,7 @@
 from vdsm.ipwrapper import (routeExists, ruleExists, addrFlush, LinkType,
                             getLinks, routeShowTable, linkDel, linkSet)
 from vdsm.netconfpersistence import (KernelConfig, RunningConfig)
-from vdsm.netinfo import (bridges, operstate, getRouteDeviceTo,
+from vdsm.netinfo import (bridges, operstate, getRouteDeviceTo, getIpInfo,
                           _get_dhclient_ifaces, BONDING_SLAVES,
                           BONDING_MASTERS, NET_CONF_PREF, OPERSTATE_UNKNOWN,
                           OPERSTATE_UP, NET_CONF_BACK_DIR)
@@ -2772,3 +2772,39 @@
             self.assertEqual(status, SUCCESS, msg)
             self.assertNetworkDoesntExist(NETWORK_NAME)
             self.assertBondDoesntExist(BONDING_NAME, nics)
+
+    @cleanupNet
+    @ValidateRunningAsRoot
+    def test_remove_initial_network_nic_ip_config(self):
+        with dummyIf(1) as nics:
+            nic, = nics
+            dummy.setIP(nic, IP_ADDRESS, IP_CIDR)
+            dummy.setIP(nic, IPv6_ADDRESS, IPv6_CIDR, family=6)
+            try:
+                status, msg = self.setupNetworks(
+                    {NETWORK_NAME: {'nic': nic, 'bridged': True}}, {}, NOCHK)
+                self.assertEqual(status, SUCCESS, msg)
+
+                _, _, ipv4addrs, ipv6addrs = getIpInfo(nic)
+                self.assertNotIn(IP_ADDRESS_AND_CIDR, ipv4addrs)
+                self.assertNotIn(IPv6_ADDRESS_AND_CIDR, ipv6addrs)
+            finally:
+                addrFlush(nic)
+
+    @cleanupNet
+    @ValidateRunningAsRoot
+    def test_keep_initial_bond_slaves_ip_config(self):
+        with dummyIf(2) as nics:
+            nic_1, nic_2 = nics
+            dummy.setIP(nic_1, IP_ADDRESS, IP_CIDR)
+            dummy.setIP(nic_1, IPv6_ADDRESS, IPv6_CIDR, family=6)
+            try:
+                status, msg = self.setupNetworks(
+                    {}, {BONDING_NAME: {'nics': [nic_1, nic_2]}}, NOCHK)
+                self.assertEqual(status, SUCCESS, msg)
+
+                _, _, ipv4addrs, ipv6addrs = getIpInfo(nic_1)
+                self.assertIn(IP_ADDRESS_AND_CIDR, ipv4addrs)
+                self.assertIn(IPv6_ADDRESS_AND_CIDR, ipv6addrs)
+            finally:
+                addrFlush(nic_1)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53068584d873b9349914262341e2a0a8cf4a4461
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to