[PATCH v2] {Net, Nm}ConfigDevice: split up() into up+address_setup
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The up() methods of NetConfigDevice and NmConfigDevice derived classes
handled both setting the device up and applying ip addresses (activating
connections, with ip addresses). Unfortunately this approach causes
problems when using NM to configure interfaces in master-slave
relationships (e.g. bond with ipv6 address and simple ethernet with no
configuration).
The solution to our NM related issues was to activate all connections
without ip address configuration, then add ip addresses to the
connections and call Reapply().
For this to work properly I also split the corresponding up() method in
NetConfigDevice classes so that the interfaces are compatible.
I split the inverse down() method into address_cleanup+down for
consistency.
This commit also propagates these changes to the rest of the LNST code
that needs to now use these new methods.
v2: override address_{setup, cleanup} methods of the UnusedInterface
class to fix a bug that left the Slave in an unusable state
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Machine.py | 12 ++++++
lnst/Controller/NetTestController.py | 3 ++
lnst/Slave/InterfaceManager.py | 9 +++++
lnst/Slave/NetConfigDevice.py | 36 ++++++++++++++---
lnst/Slave/NetTestSlave.py | 14 +++++++
lnst/Slave/NmConfigDevice.py | 78 +++++++++++++++++++++++++++---------
6 files changed, 127 insertions(+), 25 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 70295ba..204a1a8 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -835,6 +835,12 @@ class Interface(object):
def down(self):
self._machine._rpc_call_x(self._netns, "set_device_down", self._id)
+ def address_setup(self):
+ self._machine._rpc_call_x(self._netns, "device_address_setup", self._id)
+
+ def address_cleanup(self):
+ self._machine._rpc_call_x(self._netns, "device_address_cleanup", self._id)
+
def set_link_up(self):
self._machine._rpc_call_x(self._netns, "set_link_up", self._id)
@@ -1214,6 +1220,12 @@ class UnusedInterface(Interface):
def down(self):
pass
+ def address_setup(self):
+ pass
+
+ def address_cleanup(self):
+ pass
+
def cleanup(self):
pass
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index a040933..860f727 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -225,6 +225,9 @@ class NetTestController:
for iface in ifaces:
iface.up()
+ for iface in ifaces:
+ iface.address_setup()
+
m.wait_interface_init()
def provision_machines(self):
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 3dc3314..949817c 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -566,6 +566,7 @@ class Device(object):
m_dev.clear_configuration()
if self._conf != None:
+ self.address_cleanup()
self.down()
self.deconfigure()
self._clear_tc_qdisc()
@@ -652,6 +653,14 @@ class Device(object):
else:
exec_cmd("ip link set %s down" % self._name)
+ def address_setup(self):
+ if self._conf != None:
+ self._conf.address_setup()
+
+ def address_cleanup(self):
+ if self._conf != None:
+ self._conf.address_cleanup()
+
def link_up(self):
exec_cmd("ip link set %s up" % self._name)
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index 960ff07..152764b 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -57,18 +57,24 @@ class NetConfigDeviceGeneric(object):
def up(self):
config = self._dev_config
+ exec_cmd("ip link set %s up" % config["name"])
+
+ def down(self):
+ config = self._dev_config
+ exec_cmd("ip link set %s down" % config["name"])
+
+ def address_setup(self):
+ config = self._dev_config
if "addresses" in config:
for address in config["addresses"]:
exec_cmd("ip addr add %s dev %s" % (address, config["name"]))
- exec_cmd("ip link set %s up" % config["name"])
- def down(self):
+ def address_cleanup(self):
config = self._dev_config
if "addresses" in config:
for address in config["addresses"]:
exec_cmd("ip addr del %s dev %s" % (address, config["name"]),
die_on_err=False)
- exec_cmd("ip link set %s down" % config["name"])
def set_addresses(self, ips):
self._dev_config["addresses"] = ips
@@ -432,9 +438,6 @@ class NetConfigDeviceOvsBridge(NetConfigDeviceGeneric):
int_ports = self._dev_config["ovs_conf"]["internals"]
br_name = self._dev_config["name"]
for iport in int_ports:
- if "addresses" in iport:
- for address in iport["addresses"]:
- exec_cmd("ip addr add %s dev %s" % (address, iport["name"]))
exec_cmd("ip link set %s up" % iport["name"])
def down(self):
@@ -448,6 +451,27 @@ class NetConfigDeviceOvsBridge(NetConfigDeviceGeneric):
super(NetConfigDeviceOvsBridge, self).down()
+ def address_setup(self):
+ super(NetConfigDeviceOvsBridge, self).up()
+
+ int_ports = self._dev_config["ovs_conf"]["internals"]
+ br_name = self._dev_config["name"]
+ for iport in int_ports:
+ if "addresses" in iport:
+ for address in iport["addresses"]:
+ exec_cmd("ip addr add %s dev %s" % (address, iport["name"]))
+
+ def address_cleanup(self):
+ super(NetConfigDeviceOvsBridge, self).up()
+
+ int_ports = self._dev_config["ovs_conf"]["internals"]
+ br_name = self._dev_config["name"]
+ for iport in int_ports:
+ if "addresses" in iport:
+ for address in iport["addresses"]:
+ exec_cmd("ip addr del %s dev %s" % (address, iport["name"]),
+ die_on_err=False)
+
@classmethod
def type_init(self):
super(NetConfigDeviceOvsBridge, self).type_init()
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index f0b3183..da1e2f4 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -254,6 +254,20 @@ class SlaveMethods:
return False
return True
+ def device_address_setup(self, if_id):
+ dev = self._if_manager.get_mapped_device(if_id)
+ dev.address_setup()
+ return True
+
+ def device_address_cleanup(self, if_id):
+ dev = self._if_manager.get_mapped_device(if_id)
+ if dev is not None:
+ dev.address_cleanup()
+ else:
+ logging.error("Device with id '%s' not found." % if_id)
+ return False
+ return True
+
def set_link_up(self, if_id):
dev = self._if_manager.get_mapped_device(if_id)
if dev is not None:
diff --git a/lnst/Slave/NmConfigDevice.py b/lnst/Slave/NmConfigDevice.py
index a9e0c1f..998c5aa 100644
--- a/lnst/Slave/NmConfigDevice.py
+++ b/lnst/Slave/NmConfigDevice.py
@@ -133,6 +133,34 @@ class NmConfigDeviceGeneric(object):
if self._connection_added:
self._nm_deactivate_connection()
+ def address_setup(self):
+ config = self._dev_config
+
+ if len(config["addresses"]) == 0:
+ return
+ else:
+ s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
+
+ self._connection["ipv4"] = s_ipv4
+ self._connection["ipv6"] = s_ipv6
+
+ self._nm_update_connection()
+
+ self._nm_reapply_connection()
+
+ def address_cleanup(self):
+ if self._connection['ipv4']['method'] == 'disabled' and\
+ self._connection['ipv6']['method'] == 'ignore':
+ return
+
+ self._connection["ipv4"] = dbus.Dictionary({'method': 'disabled'},
+ signature='sv')
+ self._connection["ipv6"] = dbus.Dictionary({'method': 'ignore'},
+ signature='sv')
+ self._nm_update_connection()
+
+ self._nm_reapply_connection()
+
@classmethod
def type_init(self):
pass
@@ -302,6 +330,26 @@ class NmConfigDeviceGeneric(object):
raise e
self._acon_obj_path = None
+ def _nm_reapply_connection(self):
+ if self._acon_obj_path == None:
+ return
+
+ config = self._dev_config
+
+ bus = self._bus
+ nm_if = self._nm_if
+
+ try:
+ device_obj_path = nm_if.GetDeviceByIpIface(config["name"])
+ except:
+ logging.error("Device needed to reapply connection doesn't exist")
+ return
+
+ dev_obj = bus.get_object(NM_BUS, device_obj_path)
+ dev_if = dbus.Interface(dev_obj, IF_PRE + ".Device")
+
+ dev_if.Reapply("", 0, 0)
+
def nm_enslave(self, slave_type, master_uuid, slave_conf):
if get_nm_version() < "1.0.0":
self._connection["connection"]["slave_type"] = slave_type
@@ -367,8 +415,6 @@ class NmConfigDeviceEth(NmConfigDeviceGeneric):
hw_addr = self._convert_hwaddr(config)
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
-
s_eth = dbus.Dictionary({'mac-address': hw_addr}, signature='sv')
s_con = dbus.Dictionary({
'type': '802-3-ethernet',
@@ -379,8 +425,9 @@ class NmConfigDeviceEth(NmConfigDeviceGeneric):
connection = dbus.Dictionary({
'802-3-ethernet': s_eth,
'connection': s_con,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6}, signature='sa{sv}')
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
+ }, signature='sa{sv}')
self._connection = connection
self._nm_add_connection()
@@ -468,12 +515,11 @@ class NmConfigDeviceBond(NmConfigDeviceGeneric):
s_bond = dbus.Dictionary({
'interface-name': config["name"]})
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
connection = dbus.Dictionary({
'bond': s_bond,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6,
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
'connection': s_bond_con})
self._connection = connection
@@ -559,12 +605,10 @@ class NmConfigDeviceBridge(NmConfigDeviceGeneric):
'interface-name': config["name"],
'stp': dbus.Boolean(False)})
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
-
connection = dbus.Dictionary({
'bridge': s_bridge,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6,
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
'connection': s_bridge_con})
self._connection = connection
@@ -686,12 +730,10 @@ class NmConfigDeviceVlan(NmConfigDeviceGeneric):
'parent': realdev,
'id': dbus.UInt32(vlan_tci)}, signature="sv")
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
-
connection = dbus.Dictionary({
'vlan': s_vlan,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6,
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
'connection': s_vlan_con})
self._connection = connection
@@ -770,12 +812,10 @@ class NmConfigDeviceTeam(NmConfigDeviceGeneric):
'interface-name': config["name"],
'config': teamd_config})
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
-
connection = dbus.Dictionary({
'team': s_team,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6,
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
'connection': s_team_con})
self._connection = connection
--
2.9.3
7 years, 7 months
[ANNOUNCEMENT] Feature freeze in 2 weeks wrt. XML recipes
by Ondrej Lichtner
Hi,
following up on the Monday LNST upstream meeting discussions, I'm
announcing that in 2 weeks time (30th of September 2016) we will stop
accepting code implementing new features for the current master branch
of LNST. If you have any features in development that you'd like to be
included into upstream or you have any features that you'd like
requested for LNST that still supports XML recipes voice them on the
mailing list until the mentioned deadline.
The reason for this is the recent creation of the 'next' branch
introducing a first Proof of Concept implementation of Python recipes.
We want to move on with further development on this branch which will
also include quite a lot of internal code refactorization and cleanup.
Because of this porting/cherry-picking new features from the current
'master' branch will become costly and we'd rather spend our time on
getting the 'next' branch to a good state as quickly as possible.
After the feature freeze, the master branch will continue to be
maintained and will receive bug fixes. I'm also planning to tag at least
one more versioned release of LNST that I'll package for Fedora and
EPEL{6,7}.
We'll remain in this state while we continue development on the 'next'
branch until we're satisfied with the user/test facing interfaces and
consider them stable. Once we reach that point we'll rename the current
'master' branch to something like 'old' and rename the 'next' branch to
'master' after which we'll also do a new versioned release that will be
completely incompatible with previous versions.
This is a rough guideline of our plan for LNST for the next couple of
months, suggestions and comments are of course welcome and we reserve
the right to change the plan at any point (obligatory disclaimer :)).
-Ondrej
7 years, 7 months
[PATCH] {Net, Nm}ConfigDevice: split up() into up+address_setup
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The up() methods of NetConfigDevice and NmConfigDevice derived classes
handled both setting the device up and applying ip addresses (activating
connections, with ip addresses). Unfortunately this approach causes
problems when using NM to configure interfaces in master-slave
relationships (e.g. bond with ipv6 address and simple ethernet with no
configuration).
The solution to our NM related issues was to activate all connections
without ip address configuration, then add ip addresses to the
connections and call Reapply().
For this to work properly I also split the corresponding up() method in
NetConfigDevice classes so that the interfaces are compatible.
I split the inverse down() method into address_cleanup+down for
consistency.
This commit also propagates these changes to the rest of the LNST code
that needs to now use these new methods.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Machine.py | 6 +++
lnst/Controller/NetTestController.py | 3 ++
lnst/Slave/InterfaceManager.py | 9 +++++
lnst/Slave/NetConfigDevice.py | 36 ++++++++++++++---
lnst/Slave/NetTestSlave.py | 14 +++++++
lnst/Slave/NmConfigDevice.py | 78 +++++++++++++++++++++++++++---------
6 files changed, 121 insertions(+), 25 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 70295ba..6fc57eb 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -835,6 +835,12 @@ class Interface(object):
def down(self):
self._machine._rpc_call_x(self._netns, "set_device_down", self._id)
+ def address_setup(self):
+ self._machine._rpc_call_x(self._netns, "device_address_setup", self._id)
+
+ def address_cleanup(self):
+ self._machine._rpc_call_x(self._netns, "device_address_cleanup", self._id)
+
def set_link_up(self):
self._machine._rpc_call_x(self._netns, "set_link_up", self._id)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index a040933..860f727 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -225,6 +225,9 @@ class NetTestController:
for iface in ifaces:
iface.up()
+ for iface in ifaces:
+ iface.address_setup()
+
m.wait_interface_init()
def provision_machines(self):
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 3dc3314..949817c 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -566,6 +566,7 @@ class Device(object):
m_dev.clear_configuration()
if self._conf != None:
+ self.address_cleanup()
self.down()
self.deconfigure()
self._clear_tc_qdisc()
@@ -652,6 +653,14 @@ class Device(object):
else:
exec_cmd("ip link set %s down" % self._name)
+ def address_setup(self):
+ if self._conf != None:
+ self._conf.address_setup()
+
+ def address_cleanup(self):
+ if self._conf != None:
+ self._conf.address_cleanup()
+
def link_up(self):
exec_cmd("ip link set %s up" % self._name)
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index 960ff07..152764b 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -57,18 +57,24 @@ class NetConfigDeviceGeneric(object):
def up(self):
config = self._dev_config
+ exec_cmd("ip link set %s up" % config["name"])
+
+ def down(self):
+ config = self._dev_config
+ exec_cmd("ip link set %s down" % config["name"])
+
+ def address_setup(self):
+ config = self._dev_config
if "addresses" in config:
for address in config["addresses"]:
exec_cmd("ip addr add %s dev %s" % (address, config["name"]))
- exec_cmd("ip link set %s up" % config["name"])
- def down(self):
+ def address_cleanup(self):
config = self._dev_config
if "addresses" in config:
for address in config["addresses"]:
exec_cmd("ip addr del %s dev %s" % (address, config["name"]),
die_on_err=False)
- exec_cmd("ip link set %s down" % config["name"])
def set_addresses(self, ips):
self._dev_config["addresses"] = ips
@@ -432,9 +438,6 @@ class NetConfigDeviceOvsBridge(NetConfigDeviceGeneric):
int_ports = self._dev_config["ovs_conf"]["internals"]
br_name = self._dev_config["name"]
for iport in int_ports:
- if "addresses" in iport:
- for address in iport["addresses"]:
- exec_cmd("ip addr add %s dev %s" % (address, iport["name"]))
exec_cmd("ip link set %s up" % iport["name"])
def down(self):
@@ -448,6 +451,27 @@ class NetConfigDeviceOvsBridge(NetConfigDeviceGeneric):
super(NetConfigDeviceOvsBridge, self).down()
+ def address_setup(self):
+ super(NetConfigDeviceOvsBridge, self).up()
+
+ int_ports = self._dev_config["ovs_conf"]["internals"]
+ br_name = self._dev_config["name"]
+ for iport in int_ports:
+ if "addresses" in iport:
+ for address in iport["addresses"]:
+ exec_cmd("ip addr add %s dev %s" % (address, iport["name"]))
+
+ def address_cleanup(self):
+ super(NetConfigDeviceOvsBridge, self).up()
+
+ int_ports = self._dev_config["ovs_conf"]["internals"]
+ br_name = self._dev_config["name"]
+ for iport in int_ports:
+ if "addresses" in iport:
+ for address in iport["addresses"]:
+ exec_cmd("ip addr del %s dev %s" % (address, iport["name"]),
+ die_on_err=False)
+
@classmethod
def type_init(self):
super(NetConfigDeviceOvsBridge, self).type_init()
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index f0b3183..da1e2f4 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -254,6 +254,20 @@ class SlaveMethods:
return False
return True
+ def device_address_setup(self, if_id):
+ dev = self._if_manager.get_mapped_device(if_id)
+ dev.address_setup()
+ return True
+
+ def device_address_cleanup(self, if_id):
+ dev = self._if_manager.get_mapped_device(if_id)
+ if dev is not None:
+ dev.address_cleanup()
+ else:
+ logging.error("Device with id '%s' not found." % if_id)
+ return False
+ return True
+
def set_link_up(self, if_id):
dev = self._if_manager.get_mapped_device(if_id)
if dev is not None:
diff --git a/lnst/Slave/NmConfigDevice.py b/lnst/Slave/NmConfigDevice.py
index a9e0c1f..998c5aa 100644
--- a/lnst/Slave/NmConfigDevice.py
+++ b/lnst/Slave/NmConfigDevice.py
@@ -133,6 +133,34 @@ class NmConfigDeviceGeneric(object):
if self._connection_added:
self._nm_deactivate_connection()
+ def address_setup(self):
+ config = self._dev_config
+
+ if len(config["addresses"]) == 0:
+ return
+ else:
+ s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
+
+ self._connection["ipv4"] = s_ipv4
+ self._connection["ipv6"] = s_ipv6
+
+ self._nm_update_connection()
+
+ self._nm_reapply_connection()
+
+ def address_cleanup(self):
+ if self._connection['ipv4']['method'] == 'disabled' and\
+ self._connection['ipv6']['method'] == 'ignore':
+ return
+
+ self._connection["ipv4"] = dbus.Dictionary({'method': 'disabled'},
+ signature='sv')
+ self._connection["ipv6"] = dbus.Dictionary({'method': 'ignore'},
+ signature='sv')
+ self._nm_update_connection()
+
+ self._nm_reapply_connection()
+
@classmethod
def type_init(self):
pass
@@ -302,6 +330,26 @@ class NmConfigDeviceGeneric(object):
raise e
self._acon_obj_path = None
+ def _nm_reapply_connection(self):
+ if self._acon_obj_path == None:
+ return
+
+ config = self._dev_config
+
+ bus = self._bus
+ nm_if = self._nm_if
+
+ try:
+ device_obj_path = nm_if.GetDeviceByIpIface(config["name"])
+ except:
+ logging.error("Device needed to reapply connection doesn't exist")
+ return
+
+ dev_obj = bus.get_object(NM_BUS, device_obj_path)
+ dev_if = dbus.Interface(dev_obj, IF_PRE + ".Device")
+
+ dev_if.Reapply("", 0, 0)
+
def nm_enslave(self, slave_type, master_uuid, slave_conf):
if get_nm_version() < "1.0.0":
self._connection["connection"]["slave_type"] = slave_type
@@ -367,8 +415,6 @@ class NmConfigDeviceEth(NmConfigDeviceGeneric):
hw_addr = self._convert_hwaddr(config)
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
-
s_eth = dbus.Dictionary({'mac-address': hw_addr}, signature='sv')
s_con = dbus.Dictionary({
'type': '802-3-ethernet',
@@ -379,8 +425,9 @@ class NmConfigDeviceEth(NmConfigDeviceGeneric):
connection = dbus.Dictionary({
'802-3-ethernet': s_eth,
'connection': s_con,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6}, signature='sa{sv}')
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
+ }, signature='sa{sv}')
self._connection = connection
self._nm_add_connection()
@@ -468,12 +515,11 @@ class NmConfigDeviceBond(NmConfigDeviceGeneric):
s_bond = dbus.Dictionary({
'interface-name': config["name"]})
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
connection = dbus.Dictionary({
'bond': s_bond,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6,
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
'connection': s_bond_con})
self._connection = connection
@@ -559,12 +605,10 @@ class NmConfigDeviceBridge(NmConfigDeviceGeneric):
'interface-name': config["name"],
'stp': dbus.Boolean(False)})
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
-
connection = dbus.Dictionary({
'bridge': s_bridge,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6,
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
'connection': s_bridge_con})
self._connection = connection
@@ -686,12 +730,10 @@ class NmConfigDeviceVlan(NmConfigDeviceGeneric):
'parent': realdev,
'id': dbus.UInt32(vlan_tci)}, signature="sv")
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
-
connection = dbus.Dictionary({
'vlan': s_vlan,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6,
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
'connection': s_vlan_con})
self._connection = connection
@@ -770,12 +812,10 @@ class NmConfigDeviceTeam(NmConfigDeviceGeneric):
'interface-name': config["name"],
'config': teamd_config})
- s_ipv4, s_ipv6 = self._nm_make_ip_settings(config["addresses"])
-
connection = dbus.Dictionary({
'team': s_team,
- 'ipv4': s_ipv4,
- 'ipv6': s_ipv6,
+ 'ipv4': dbus.Dictionary({'method': 'disabled'}, signature='sv'),
+ 'ipv6': dbus.Dictionary({'method': 'ignore'}, signature='sv'),
'connection': s_team_con})
self._connection = connection
--
2.9.3
7 years, 7 months
[PATCH 00/16] Quality of Service recipes
by Ido Schimmel
From: Ido Schimmel <idosch(a)mellanox.com>
Hi,
Patches 1-11 add the missing lldptool and devlink infrastructure to LNST
and also extend the PktgenTx module for the QoS recipes.
Patches 12-16 add the individual QoS recipes.
Please check the individual commit messages for more details.
Thanks.
Ido Schimmel (16):
HostAPI: Add LLDP support
HostAPI: Allow recipes to query number of CPUs
InterfaceAPI: Add ethtool statistics query
InterfaceAPI: Add LLDP support
InterfaceAPI: Add PAUSE frames setting methods
PktgenTx: Add per-thread options
PktgenTx: Remove all devices from all threads in init
PktgenTx: Sort pktgen options before applying them
recipes: switchdev: TestLib: Add wrappers for LLDP operations
recipes: switchdev: TestLib: Add wrappers for devlink operations
recipes: switchdev: TestLib: Add kwargs support for pktgen invocation
recipes: switchdev: qos: Add recipe for PCP to PG mapping
recipes: switchdev: qos: Add recipe for PCP to TC mapping
recipes: switchdev: qos: Add recipe for PAUSE frames
recipes: switchdev: qos: Add recipe for PFC frames
recipes: switchdev: qos: Add recipe for ETS
lnst/Controller/Machine.py | 32 +++++++
lnst/Controller/Task.py | 18 ++++
lnst/Slave/InterfaceManager.py | 20 +++++
lnst/Slave/NetConfigDevice.py | 20 +++++
lnst/Slave/NetTestSlave.py | 44 +++++++++
recipes/switchdev/TestLib.py | 163 +++++++++++++++++++++++++++++++++-
recipes/switchdev/default_aliases.xml | 4 +
recipes/switchdev/qos-001-pg.py | 71 +++++++++++++++
recipes/switchdev/qos-001-pg.xml | 22 +++++
recipes/switchdev/qos-002-tc.py | 71 +++++++++++++++
recipes/switchdev/qos-002-tc.xml | 22 +++++
recipes/switchdev/qos-003-pause.py | 91 +++++++++++++++++++
recipes/switchdev/qos-003-pause.xml | 22 +++++
recipes/switchdev/qos-004-pfc.py | 95 ++++++++++++++++++++
recipes/switchdev/qos-004-pfc.xml | 22 +++++
recipes/switchdev/qos-005-ets.py | 133 +++++++++++++++++++++++++++
recipes/switchdev/qos-005-ets.xml | 22 +++++
test_modules/PktgenTx.py | 17 +++-
18 files changed, 883 insertions(+), 6 deletions(-)
create mode 100644 recipes/switchdev/qos-001-pg.py
create mode 100644 recipes/switchdev/qos-001-pg.xml
create mode 100644 recipes/switchdev/qos-002-tc.py
create mode 100644 recipes/switchdev/qos-002-tc.xml
create mode 100644 recipes/switchdev/qos-003-pause.py
create mode 100644 recipes/switchdev/qos-003-pause.xml
create mode 100644 recipes/switchdev/qos-004-pfc.py
create mode 100644 recipes/switchdev/qos-004-pfc.xml
create mode 100644 recipes/switchdev/qos-005-ets.py
create mode 100644 recipes/switchdev/qos-005-ets.xml
--
2.7.4
7 years, 7 months
meeting minutes 2016-09-12
by Jan Tluka
LNST upstream meeting 2016-09-12
JiriPi, Jan, Ondrej, Ido, Yotam
. Ondrej wants to release last non-pyrecipes version and then do a code
freeze on master branch, all new features should be then done on next
branch; we should be careful what goes in master branch since we want
to merge with the next branch in the future and want to have this as
smooth as possible
. Ido about to sent few patches this week
. Ondrej will send email about code freeze for master branch
. @all, please run regression tests + smoke tests when you're about to
submit a patch
=> add some howto to PATCHES file
. how about keeping doc in git?
. formalize pyrecipes draft and sent it to lnst-developers mailing list so
that other can comment and give feedback and ideas
. Ido: feature request, adding per-machine kernel logs to LNST
. next meeting will be in two weeks, then we'll follow monthly schedule
-Jan
7 years, 7 months
[PATCH v2] InterfaceManager: fix tc deconfiguration
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The recently added functionality of clearing tc configuration broke
recipes that already used netem functionality directly from the
configuration XML part. The problem was with trying to clear tc
configuration twice.
To fixed this I moved the new functions to be called after deconfigure()
takes care of it's own tc configuration. For this to work I also had to
add a check for interface existence since deconfigure() can remove the
device completely if NetworkManager is used.
Fixes: 49e523d5 ("Slave: Add basic support for tc.")
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
v2: *add "Fixes:..." line on jpirkos request
---
lnst/Slave/InterfaceManager.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 337d08b..3dc3314 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -520,6 +520,13 @@ class Device(object):
self._conf_dict = None
def _clear_tc_qdisc(self):
+ try:
+ #checks device existence as it might have been removed by
+ #calling self.deconfigure()
+ exec_cmd("ip l show %s" % self._name, log_outputs=False)
+ except:
+ return
+
exec_cmd("tc qdisc replace dev %s root pfifo" % self._name)
out, _ = exec_cmd("tc filter show dev %s" % self._name)
ingress_handles = re.findall("ingress (\\d+):", out)
@@ -532,6 +539,13 @@ class Device(object):
exec_cmd("tc qdisc del dev %s ingress" % self._name)
def _clear_tc_filters(self):
+ try:
+ #checks device existence as it might have been removed by
+ #calling self.deconfigure()
+ exec_cmd("ip l show %s" % self._name, log_outputs=False)
+ except:
+ return
+
out, _ = exec_cmd("tc filter show dev %s" % self._name)
egress_prefs = re.findall("pref (\\d+) .* handle", out)
@@ -552,10 +566,10 @@ class Device(object):
m_dev.clear_configuration()
if self._conf != None:
- self._clear_tc_qdisc()
- self._clear_tc_filters()
self.down()
self.deconfigure()
+ self._clear_tc_qdisc()
+ self._clear_tc_filters()
self.destroy()
self._conf = None
self._conf_dict = None
--
2.9.3
7 years, 7 months
[PATCH] NetTestController: handle keyboard interrupt during remote exec
by Roi Dayan
Catching Exception doesn't catch KeyboardInterrupt that should be handled
and fill cmd_res which is being used in the finally block.
Signed-off-by: Roi Dayan <roid(a)mellanox.com>
---
lnst/Controller/NetTestController.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index c8a58b3..a040933 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -760,7 +760,7 @@ class NetTestController:
try:
cmd_res = machine.run_command(command)
- except Exception as exc:
+ except (KeyboardInterrupt, Exception) as exc:
cmd_res = {"passed": False,
"res_data": {"Exception": str(exc)},
"msg": "Exception raised.",
--
1.8.4.3
7 years, 7 months
[PATCH v2] recipes: add driver alias to regression tests
by Jan Tluka
All recipes in phase1 and phase2 directory now take alias named
'driver'. By default it's value is 'ixgbe'.
Changes in V2:
add default value for driver alias in 3_vlans.xml
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
recipes/regression_tests/phase1/3_vlans.xml | 13 +++++++++--
.../phase1/3_vlans_over_active_backup_bond.xml | 19 +++++++++++++---
.../regression_tests/phase1/active_backup_bond.xml | 16 +++++++++++--
.../phase1/active_backup_double_bond.xml | 25 +++++++++++++++++----
recipes/regression_tests/phase1/ping_flood.xml | 7 ++++++
recipes/regression_tests/phase1/simple_netperf.xml | 7 ++++++
...tual_bridge_2_vlans_over_active_backup_bond.xml | 25 +++++++++++++++++----
.../phase1/virtual_bridge_vlan_in_guest.xml | 13 +++++++++--
.../phase1/virtual_bridge_vlan_in_host.xml | 13 +++++++++--
.../phase2/3_vlans_over_active_backup_team.xml | 19 +++++++++++++---
.../phase2/active_backup_double_team.xml | 26 ++++++++++++++++++----
.../regression_tests/phase2/active_backup_team.xml | 16 +++++++++++--
.../active_backup_team_vs_active_backup_bond.xml | 25 +++++++++++++++++----
..._ovs_bridge_2_vlans_over_active_backup_bond.xml | 25 +++++++++++++++++----
.../phase2/virtual_ovs_bridge_vlan_in_guest.xml | 13 +++++++++--
.../phase2/virtual_ovs_bridge_vlan_in_host.xml | 10 ++++++++-
16 files changed, 233 insertions(+), 39 deletions(-)
diff --git a/recipes/regression_tests/phase1/3_vlans.xml b/recipes/regression_tests/phase1/3_vlans.xml
index 5c0f1fe..3c56aad 100644
--- a/recipes/regression_tests/phase1/3_vlans.xml
+++ b/recipes/regression_tests/phase1/3_vlans.xml
@@ -17,11 +17,16 @@
<alias name="vlan20_tag" value="20"/>
<alias name="vlan30_net" value="192.168.30"/>
<alias name="vlan30_tag" value="30"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="testmachine1">
<interfaces>
- <eth id="eth1" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<vlan id="vlan10">
<options>
<option name="vlan_tci" value="{$vlan10_tag}" />
@@ -62,7 +67,11 @@
</host>
<host id="testmachine2">
<interfaces>
- <eth id="eth1" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<vlan id="vlan10">
<options>
<option name="vlan_tci" value="{$vlan10_tag}" />
diff --git a/recipes/regression_tests/phase1/3_vlans_over_active_backup_bond.xml b/recipes/regression_tests/phase1/3_vlans_over_active_backup_bond.xml
index 26300b1..431202b 100644
--- a/recipes/regression_tests/phase1/3_vlans_over_active_backup_bond.xml
+++ b/recipes/regression_tests/phase1/3_vlans_over_active_backup_bond.xml
@@ -17,12 +17,21 @@
<alias name="vlan20_tag" value="20"/>
<alias name="vlan30_net" value="192.168.30"/>
<alias name="vlan30_tag" value="30"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="testmachine1">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<bond id="test_bond">
<options>
<option name="mode" value="active-backup" />
@@ -73,7 +82,11 @@
</host>
<host id="testmachine2">
<interfaces>
- <eth id="eth1" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<vlan id="vlan10">
<options>
<option name="vlan_tci" value="{$vlan10_tag}" />
diff --git a/recipes/regression_tests/phase1/active_backup_bond.xml b/recipes/regression_tests/phase1/active_backup_bond.xml
index 0b79f4c..ce2e610 100644
--- a/recipes/regression_tests/phase1/active_backup_bond.xml
+++ b/recipes/regression_tests/phase1/active_backup_bond.xml
@@ -12,12 +12,21 @@
<alias name="nperf_max_dev" value="20%"/>
<alias name="mapping_file" value="active_backup_bond.mapping" />
<alias name="net" value="192.168.0"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="testmachine1">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<bond id="test_if">
<options>
<option name="mode" value="active-backup" />
@@ -37,6 +46,9 @@
<host id="testmachine2">
<interfaces>
<eth id="test_if" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
<addresses>
<address value="{$net}.2/24" />
<address value="fc00:0:0:0::2/64"/>
diff --git a/recipes/regression_tests/phase1/active_backup_double_bond.xml b/recipes/regression_tests/phase1/active_backup_double_bond.xml
index bc39db8..5154504 100644
--- a/recipes/regression_tests/phase1/active_backup_double_bond.xml
+++ b/recipes/regression_tests/phase1/active_backup_double_bond.xml
@@ -12,12 +12,21 @@
<alias name="nperf_max_dev" value="20%"/>
<alias name="mapping_file" value="active_backup_double_bond.mapping" />
<alias name="net" value="192.168.0"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="testmachine1">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<bond id="test_if">
<options>
<option name="mode" value="active-backup" />
@@ -36,8 +45,16 @@
</host>
<host id="testmachine2">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<bond id="test_if">
<options>
<option name="mode" value="active-backup" />
diff --git a/recipes/regression_tests/phase1/ping_flood.xml b/recipes/regression_tests/phase1/ping_flood.xml
index 5ccac21..68b6d57 100644
--- a/recipes/regression_tests/phase1/ping_flood.xml
+++ b/recipes/regression_tests/phase1/ping_flood.xml
@@ -3,11 +3,15 @@
<alias name="ipv" value="both" />
<alias name="mtu" value="1500" />
<alias name="net" value="192.168.101" />
+ <alias name="driver" value="ixgbe" />
</define>
<network>
<host id="machine1">
<interfaces>
<eth id="testiface" label="testnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
<addresses>
<address>{$net}.10/24</address>
<address>fc00:0:0:0::1/64</address>
@@ -18,6 +22,9 @@
<host id="machine2">
<interfaces>
<eth id="testiface" label="testnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
<addresses>
<address>{$net}.11/24</address>
<address>fc00:0:0:0::2/64</address>
diff --git a/recipes/regression_tests/phase1/simple_netperf.xml b/recipes/regression_tests/phase1/simple_netperf.xml
index 0f106aa..a202852 100644
--- a/recipes/regression_tests/phase1/simple_netperf.xml
+++ b/recipes/regression_tests/phase1/simple_netperf.xml
@@ -12,11 +12,15 @@
<alias name="nperf_max_dev" value="20%"/>
<alias name="mapping_file" value="simple_netperf.mapping" />
<alias name="net" value="192.168.101" />
+ <alias name="driver" value="ixgbe" />
</define>
<network>
<host id="machine1">
<interfaces>
<eth id="testiface" label="testnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
<addresses>
<address>{$net}.10/24</address>
<address>fc00:0:0:0::1/64</address>
@@ -27,6 +31,9 @@
<host id="machine2">
<interfaces>
<eth id="testiface" label="testnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
<addresses>
<address>{$net}.11/24</address>
<address>fc00:0:0:0::2/64</address>
diff --git a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_active_backup_bond.xml b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_active_backup_bond.xml
index 5b5223e..9a2b3f4 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_active_backup_bond.xml
+++ b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_active_backup_bond.xml
@@ -15,12 +15,21 @@
<alias name="vlan10_tag" value="10"/>
<alias name="vlan20_net" value="192.168.20"/>
<alias name="vlan20_tag" value="20"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="host1">
<interfaces>
- <eth id="nic1" label="to_switch" />
- <eth id="nic2" label="to_switch" />
+ <eth id="nic1" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
+ <eth id="nic2" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<eth id="tap1" label="to_guest1" />
<eth id="tap2" label="to_guest2" />
<bond id="bond">
@@ -95,8 +104,16 @@
<host id="host2">
<interfaces>
- <eth id="nic1" label="to_switch"/>
- <eth id="nic2" label="to_switch"/>
+ <eth id="nic1" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
+ <eth id="nic2" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<eth id="tap1" label="to_guest3"/>
<eth id="tap2" label="to_guest4"/>
<bond id="bond">
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.xml b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.xml
index 7768542..dd33be1 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.xml
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.xml
@@ -13,6 +13,7 @@
<alias name="mapping_file" value="virtual_bridge_vlan_in_guest.mapping" />
<alias name="vlan10_net" value="192.168.10"/>
<alias name="vlan10_tag" value="10"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="host1">
@@ -20,7 +21,11 @@
<param name="machine_type" value="baremetal"/>
</params>
<interfaces>
- <eth id="nic" label="to_switch" />
+ <eth id="nic" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<eth id="tap" label="to_guest" />
<bridge id="br">
<slaves>
@@ -59,7 +64,11 @@
<param name="machine_type" value="baremetal"/>
</params>
<interfaces>
- <eth id="nic" label="to_switch" />
+ <eth id="nic" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<vlan id="vlan10">
<options>
<option name="vlan_tci" value="{$vlan10_tag}" />
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.xml b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.xml
index a38848b..382d9c6 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.xml
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.xml
@@ -13,6 +13,7 @@
<alias name="mapping_file" value="virtual_bridge_vlan_in_host.mapping" />
<alias name="vlan10_net" value="192.168.10"/>
<alias name="vlan10_tag" value="10"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="host1">
@@ -20,7 +21,11 @@
<param name="machine_type" value="baremetal"/>
</params>
<interfaces>
- <eth id="nic" label="to_switch" />
+ <eth id="nic" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<eth id="tap" label="to_guest" />
<vlan id="vlan10">
<options>
@@ -59,7 +64,11 @@
<param name="machine_type" value="baremetal"/>
</params>
<interfaces>
- <eth id="nic" label="to_switch" />
+ <eth id="nic" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<vlan id="vlan10">
<options>
<option name="vlan_tci" value="{$vlan10_tag}" />
diff --git a/recipes/regression_tests/phase2/3_vlans_over_active_backup_team.xml b/recipes/regression_tests/phase2/3_vlans_over_active_backup_team.xml
index c2a5117..683675f 100644
--- a/recipes/regression_tests/phase2/3_vlans_over_active_backup_team.xml
+++ b/recipes/regression_tests/phase2/3_vlans_over_active_backup_team.xml
@@ -17,12 +17,21 @@
<alias name="vlan20_tag" value="20"/>
<alias name="vlan30_net" value="192.168.30"/>
<alias name="vlan30_tag" value="30"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="testmachine1">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<team id="test_if">
<options>
<option name="teamd_config">
@@ -80,7 +89,11 @@
</host>
<host id="testmachine2">
<interfaces>
- <eth id="eth1" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<vlan id="vlan10">
<options>
<option name="vlan_tci" value="{$vlan10_tag}" />
diff --git a/recipes/regression_tests/phase2/active_backup_double_team.xml b/recipes/regression_tests/phase2/active_backup_double_team.xml
index 3825fb0..420992f 100644
--- a/recipes/regression_tests/phase2/active_backup_double_team.xml
+++ b/recipes/regression_tests/phase2/active_backup_double_team.xml
@@ -12,12 +12,22 @@
<alias name="nperf_max_dev" value="20%"/>
<alias name="mapping_file" value="active_backup_double_team.mapping" />
<alias name="net" value="192.168.0"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="testmachine1">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+
<team id="test_if">
<options>
<option name="teamd_config">
@@ -40,8 +50,16 @@
</host>
<host id="testmachine2">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<team id="test_if">
<options>
<option name="teamd_config">
diff --git a/recipes/regression_tests/phase2/active_backup_team.xml b/recipes/regression_tests/phase2/active_backup_team.xml
index abf4451..7a1f059 100644
--- a/recipes/regression_tests/phase2/active_backup_team.xml
+++ b/recipes/regression_tests/phase2/active_backup_team.xml
@@ -12,12 +12,21 @@
<alias name="nperf_max_dev" value="20%"/>
<alias name="mapping_file" value="active_backup_team.mapping" />
<alias name="net" value="192.168.0"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="testmachine1">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<team id="test_if">
<options>
<option name="teamd_config">
@@ -41,6 +50,9 @@
<host id="testmachine2">
<interfaces>
<eth id="test_if" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
<addresses>
<address value="{$net}.2/24" />
<address value="fc00:0:0:0::2/64" />
diff --git a/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml b/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml
index e0cb9c1..37e0d02 100644
--- a/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml
+++ b/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml
@@ -12,12 +12,21 @@
<alias name="nperf_max_dev" value="20%"/>
<alias name="mapping_file" value="active_backup_team_vs_active_backup_bond.mapping" />
<alias name="net" value="192.168.0"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="testmachine1">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<team id="test_if">
<options>
<option name="teamd_config">
@@ -40,8 +49,16 @@
</host>
<host id="testmachine2">
<interfaces>
- <eth id="eth1" label="tnet" />
- <eth id="eth2" label="tnet" />
+ <eth id="eth1" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
+ <eth id="eth2" label="tnet">
+ <params>
+ <param name="driver" value="{$driver}"/>
+ </params>
+ </eth>
<bond id="test_if">
<options>
<option name="mode" value="active-backup" />
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.xml b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.xml
index 4f34ac5..32b4c06 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.xml
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.xml
@@ -14,12 +14,21 @@
<alias name="vlan10_tag" value="10"/>
<alias name="vlan20_net" value="192.168.20"/>
<alias name="vlan20_tag" value="20"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="host1">
<interfaces>
- <eth id="nic1" label="to_switch" />
- <eth id="nic2" label="to_switch" />
+ <eth id="nic1" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
+ <eth id="nic2" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<eth id="tap1" label="to_guest1" />
<eth id="tap2" label="to_guest2" />
<ovs_bridge id="bridge">
@@ -75,8 +84,16 @@
<host id="host2">
<interfaces>
- <eth id="nic1" label="to_switch"/>
- <eth id="nic2" label="to_switch"/>
+ <eth id="nic1" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
+ <eth id="nic2" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<eth id="tap1" label="to_guest3"/>
<eth id="tap2" label="to_guest4"/>
<ovs_bridge id="bridge">
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.xml b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.xml
index bfea7a0..ae85997 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.xml
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.xml
@@ -12,6 +12,7 @@
<alias name="mapping_file" value="virtual_ovs_bridge_vlan_in_guest.mapping" />
<alias name="vlan10_net" value="192.168.10"/>
<alias name="vlan10_tag" value="10"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="host1">
@@ -19,7 +20,11 @@
<param name="machine_type" value="baremetal"/>
</params>
<interfaces>
- <eth id="nic" label="to_switch" />
+ <eth id="nic" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<eth id="tap" label="to_guest" />
<ovs_bridge id="br">
<slaves>
@@ -55,7 +60,11 @@
<param name="machine_type" value="baremetal"/>
</params>
<interfaces>
- <eth id="nic" label="to_switch" />
+ <eth id="nic" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<vlan id="vlan10">
<options>
<option name="vlan_tci" value="{$vlan10_tag}" />
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.xml b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.xml
index ea8f41a..6b2a271 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.xml
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.xml
@@ -12,6 +12,7 @@
<alias name="mapping_file" value="virtual_ovs_bridge_vlan_in_host.mapping" />
<alias name="vlan10_net" value="192.168.10"/>
<alias name="vlan10_tag" value="10"/>
+ <alias name="driver" value="ixgbe"/>
</define>
<network>
<host id="host1">
@@ -19,7 +20,11 @@
<param name="machine_type" value="baremetal"/>
</params>
<interfaces>
- <eth id="nic" label="to_switch"/>
+ <eth id="nic" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
+ </eth>
<eth id="tap" label="to_guest"/>
<ovs_bridge id="ovs_br">
<slaves>
@@ -53,6 +58,9 @@
</params>
<interfaces>
<eth id="nic" label="to_switch">
+ <params>
+ <param name="driver" value="{$driver}" />
+ </params>
</eth>
<vlan id="vlan10">
<options>
--
2.4.11
7 years, 7 months
[PATCH 1/2] NetConfigDeviceOvsBridge: Don't try to run ovs services if already running
by Roi Dayan
This helps reduce errors from the debug log.
Signed-off-by: Roi Dayan <roid(a)mellanox.com>
---
lnst/Slave/NetConfigDevice.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index 89d471e..960ff07 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -17,6 +17,7 @@ from lnst.Common.ExecCmd import exec_cmd
from lnst.Slave.NetConfigCommon import get_slaves, get_option, get_slave_option
from lnst.Slave.NetConfigCommon import parse_netem, get_slave_options
from lnst.Common.Utils import bool_it
+from lnst.Common.Utils import check_process_running
from lnst.Slave.NmConfigDevice import type_class_mapping as nm_type_class_mapping
from lnst.Slave.NmConfigDevice import is_nm_managed
@@ -450,11 +451,13 @@ class NetConfigDeviceOvsBridge(NetConfigDeviceGeneric):
@classmethod
def type_init(self):
super(NetConfigDeviceOvsBridge, self).type_init()
- exec_cmd("mkdir -p /var/run/openvswitch/")
- exec_cmd("ovsdb-server --detach --pidfile "\
+ if not check_process_running("ovsdb-server"):
+ exec_cmd("mkdir -p /var/run/openvswitch/")
+ exec_cmd("ovsdb-server --detach --pidfile "\
"--remote=punix:/var/run/openvswitch/db.sock",
die_on_err=False)
- exec_cmd("ovs-vswitchd --detach --pidfile", die_on_err=False)
+ if not check_process_running("ovs-vswitchd"):
+ exec_cmd("ovs-vswitchd --detach --pidfile", die_on_err=False)
def _add_ports(self):
slaves = self._dev_config["slaves"]
--
1.8.4.3
7 years, 7 months
[PATCH] recipes: switchdev: Use only two interfaces to test LinkNeg
by Ido Schimmel
From: Ido Schimmel <idosch(a)mellanox.com>
We should only specify two interfaces for the link negotiation recipe.
We can use 'multi-match' to test all possible matches.
Signed-off-by: Ido Schimmel <idosch(a)mellanox.com>
---
recipes/switchdev/basic-001-links.py | 23 ++++-------------------
recipes/switchdev/basic-001-links.xml | 6 ------
2 files changed, 4 insertions(+), 25 deletions(-)
diff --git a/recipes/switchdev/basic-001-links.py b/recipes/switchdev/basic-001-links.py
index 924fdaf..4cf9726 100644
--- a/recipes/switchdev/basic-001-links.py
+++ b/recipes/switchdev/basic-001-links.py
@@ -31,35 +31,20 @@ def linkneg(tl, if1, if2):
tl.ping_simple(if1, if2)
def do_task(ctl, hosts, ifaces, aliases):
- m1, sw = hosts
- m1_if1, m1_if2, m1_if3, m1_if4, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces
+ m1_if1, sw_if1 = ifaces
m1_if1.reset(ip=["192.168.101.10/24", "2002::1/64"])
- m1_if2.reset(ip=["192.168.102.10/24", "2003::1/64"])
- m1_if3.reset(ip=["192.168.103.10/24", "2004::1/64"])
- m1_if4.reset(ip=["192.168.104.10/24", "2005::1/64"])
sw_if1.reset(ip=["192.168.101.11/24", "2002::2/64"])
- sw_if2.reset(ip=["192.168.102.11/24", "2003::2/64"])
- sw_if3.reset(ip=["192.168.103.11/24", "2004::2/64"])
- sw_if4.reset(ip=["192.168.104.11/24", "2005::2/64"])
sleep(30)
tl = TestLib(ctl, aliases)
- for (if1, if2) in [(sw_if1, m1_if1), (sw_if2, m1_if2), (sw_if3, m1_if3),
- (sw_if4, m1_if4)]:
- linkneg(tl, if1, if2)
- linkneg(tl, if2, if1)
+ linkneg(tl, sw_if1, m1_if1)
+ linkneg(tl, m1_if1, sw_if1)
do_task(ctl, [ctl.get_host("machine1"),
ctl.get_host("switch")],
[ctl.get_host("machine1").get_interface("if1"),
- ctl.get_host("machine1").get_interface("if2"),
- ctl.get_host("machine1").get_interface("if3"),
- ctl.get_host("machine1").get_interface("if4"),
- ctl.get_host("switch").get_interface("if1"),
- ctl.get_host("switch").get_interface("if2"),
- ctl.get_host("switch").get_interface("if3"),
- ctl.get_host("switch").get_interface("if4")],
+ ctl.get_host("switch").get_interface("if1")],
ctl.get_aliases())
diff --git a/recipes/switchdev/basic-001-links.xml b/recipes/switchdev/basic-001-links.xml
index 1663299..79d25db 100644
--- a/recipes/switchdev/basic-001-links.xml
+++ b/recipes/switchdev/basic-001-links.xml
@@ -5,17 +5,11 @@
<params/>
<interfaces>
<eth id="if1" label="A" />
- <eth id="if2" label="B" />
- <eth id="if3" label="C" />
- <eth id="if4" label="D" />
</interfaces>
</host>
<host id="switch">
<interfaces>
<eth id="if1" label="A" />
- <eth id="if2" label="B" />
- <eth id="if3" label="C" />
- <eth id="if4" label="D" />
</interfaces>
</host>
</network>
--
2.7.4
7 years, 7 months