]> git.ipfire.org Git - thirdparty/lldpd.git/blobdiff - tests/integration/fixtures/network.py
tests: enable test for team device
[thirdparty/lldpd.git] / tests / integration / fixtures / network.py
index 42ff48e1798a54f8cf9766dbfba043fc5d656c21..e5f45f2dbcaffa3707a5914f8fe254891c185467 100644 (file)
@@ -77,12 +77,12 @@ class LinksFactory(object):
         ipr.link('set', index=idx, state='up')
         return idx
 
-    def bond(self, name, *ifaces):
-        """Create a bond."""
-        ipr = pyroute2.IPRoute()
+    def _bond_or_team(self, kind, name, *ifaces):
+        """Create a bond or a team."""
+        ipr = pyroute2.RawIPRoute()
         # Create the bond
         ipr.link_create(ifname=name,
-                        kind='bond')
+                        kind=kind)
         idx = ipr.link_lookup(ifname=name)[0]
         # Attach interfaces
         for iface in ifaces:
@@ -93,6 +93,16 @@ class LinksFactory(object):
         ipr.link('set', index=idx, state='up')
         return idx
 
+    def team(self, name, *ifaces):
+        """Create a team."""
+        # Unfortunately, pyroute2 will try to run teamd too. This
+        # doesn't work.
+        return self._bond_or_team("team", name, *ifaces)
+
+    def bond(self, name, *ifaces):
+        """Create a bond."""
+        return self._bond_or_team("bond", name, *ifaces)
+
     def vlan(self, name, id, iface):
         """Create a VLAN."""
         ipr = pyroute2.IPRoute()