aboutsummaryrefslogtreecommitdiffstats
path: root/vswitches
diff options
context:
space:
mode:
Diffstat (limited to 'vswitches')
-rw-r--r--vswitches/ovs.py27
-rw-r--r--vswitches/ovs_dpdk_vhost.py2
-rw-r--r--vswitches/vpp_dpdk_vhost.py9
-rw-r--r--vswitches/vswitch.py7
4 files changed, 43 insertions, 2 deletions
diff --git a/vswitches/ovs.py b/vswitches/ovs.py
index 7e16c142..76cabb0d 100644
--- a/vswitches/ovs.py
+++ b/vswitches/ovs.py
@@ -91,6 +91,27 @@ class IVSwitchOvs(IVSwitch, tasks.Process):
self._logger.info("Vswitchd...Started.")
+ def restart(self):
+ """ Restart ``ovs-vswitchd`` instance. ``ovsdb-server`` is not restarted.
+
+ :raises: pexpect.EOF, pexpect.TIMEOUT
+ """
+ self._logger.info("Restarting vswitchd...")
+ if os.path.isfile(self._vswitchd_pidfile_path):
+ self._logger.info('Killing ovs-vswitchd...')
+ with open(self._vswitchd_pidfile_path, "r") as pidfile:
+ vswitchd_pid = pidfile.read().strip()
+ tasks.terminate_task(vswitchd_pid, logger=self._logger)
+
+ try:
+ tasks.Process.start(self)
+ self.relinquish()
+ except (pexpect.EOF, pexpect.TIMEOUT) as exc:
+ logging.error("Exception during VSwitch start.")
+ self._kill_ovsdb()
+ raise exc
+ self._logger.info("Vswitchd...Started.")
+
def configure(self):
""" Configure vswitchd through ovsdb if needed
"""
@@ -109,6 +130,7 @@ class IVSwitchOvs(IVSwitch, tasks.Process):
"""
self._logger.info("Terminating vswitchd...")
self.kill()
+ self._bridges = {}
self._logger.info("Vswitchd...Terminated.")
def add_switch(self, switch_name, params=None):
@@ -488,3 +510,8 @@ class IVSwitchOvs(IVSwitch, tasks.Process):
"""
bridge = self._bridges[switch_name]
return 'stp_enable : true' in ''.join(bridge.bridge_info())
+
+ def validate_restart(self, dummy_result):
+ """ Validate restart
+ """
+ return True
diff --git a/vswitches/ovs_dpdk_vhost.py b/vswitches/ovs_dpdk_vhost.py
index 3b20be35..11b32c88 100644
--- a/vswitches/ovs_dpdk_vhost.py
+++ b/vswitches/ovs_dpdk_vhost.py
@@ -149,7 +149,7 @@ class OvsDpdkVhost(IVSwitchOvs):
nic_type = 'dpdkvhostuserclient'
vhost_count = self._get_port_count('type={}'.format(nic_type))
- port_name = 'dpdkvhostuser' + str(vhost_count)
+ port_name = nic_type + str(vhost_count)
params = ['--', 'set', 'Interface', port_name, 'type={}'.format(nic_type)]
if not S.getValue('VSWITCH_VHOSTUSER_SERVER_MODE'):
params += ['--', 'set', 'Interface', port_name, 'options:vhost-server-path='
diff --git a/vswitches/vpp_dpdk_vhost.py b/vswitches/vpp_dpdk_vhost.py
index bb472788..c62e28d4 100644
--- a/vswitches/vpp_dpdk_vhost.py
+++ b/vswitches/vpp_dpdk_vhost.py
@@ -50,6 +50,7 @@ class VppDpdkVhost(IVSwitch, tasks.Process):
self._phy_ports = []
self._virt_ports = []
self._switches = {}
+ self._vpp_ctl = ['sudo', S.getValue('TOOLS')['vppctl']]
# configure DPDK NICs
tmp_args = copy.deepcopy(S.getValue('VSWITCH_VPP_ARGS'))
@@ -71,6 +72,12 @@ class VppDpdkVhost(IVSwitch, tasks.Process):
# configure path to the plugins
tmp_args['plugin_path'] = S.getValue('TOOLS')['vpp_plugin_path']
+ # cli sock file must be used for VPP 17.10 and newer
+ if S.getValue('VSWITCH_VPP_CLI_SOCK'):
+ self._vpp_ctl += ['-s', S.getValue('VSWITCH_VPP_CLI_SOCK')]
+ tmp_args['unix'].append('cli-listen {}'.format(
+ S.getValue('VSWITCH_VPP_CLI_SOCK')))
+
mqs = int(S.getValue('VSWITCH_DPDK_MULTI_QUEUES'))
tmp_rxqs = ''
if mqs:
@@ -371,7 +378,7 @@ class VppDpdkVhost(IVSwitch, tasks.Process):
:return: None
"""
- cmd = ['sudo', S.getValue('TOOLS')['vppctl']] + args
+ cmd = self._vpp_ctl + args
return tasks.run_task(cmd, self._logger, 'Running vppctl...', check_error)
#
diff --git a/vswitches/vswitch.py b/vswitches/vswitch.py
index dd69e6d9..efa3a349 100644
--- a/vswitches/vswitch.py
+++ b/vswitches/vswitch.py
@@ -36,6 +36,13 @@ class IVSwitch(object):
"""
raise NotImplementedError()
+ def restart(self):
+ """Retart the vSwitch
+
+ Restart of vSwitch is required for failover testcases.
+ """
+ raise NotImplementedError()
+
def stop(self):
"""Stop the vSwitch