aboutsummaryrefslogtreecommitdiffstats
path: root/vswitches
diff options
context:
space:
mode:
Diffstat (limited to 'vswitches')
-rw-r--r--vswitches/vpp_dpdk_vhost.py36
1 files changed, 34 insertions, 2 deletions
diff --git a/vswitches/vpp_dpdk_vhost.py b/vswitches/vpp_dpdk_vhost.py
index 68375538..42f1cdf1 100644
--- a/vswitches/vpp_dpdk_vhost.py
+++ b/vswitches/vpp_dpdk_vhost.py
@@ -63,6 +63,14 @@ class VppDpdkVhost(IVSwitch, tasks.Process):
tmp_args['dpdk'].append('socket-mem ' +
','.join(S.getValue('DPDK_SOCKET_MEM')))
+ # create directory for vhostuser sockets if needed
+ if not os.path.exists(S.getValue('TOOLS')['ovs_var_tmp']):
+ tasks.run_task(['sudo', 'mkdir', '-p',
+ S.getValue('TOOLS')['ovs_var_tmp']], self._logger)
+
+ # configure path to the plugins
+ tmp_args['plugin_path'] = S.getValue('TOOLS')['vpp_plugin_path']
+
for nic in S.getValue('NICS'):
tmp_args['dpdk'].append("dev {}".format(nic['pci']))
self._vswitch_args = self._process_vpp_args(tmp_args)
@@ -84,6 +92,8 @@ class VppDpdkVhost(IVSwitch, tasks.Process):
keyidx = keys.index(key)
for iface in ifaces[1:]:
tmpif = iface.split()
+ if not tmpif:
+ continue
# get PCI address of given interface
output = self.run_vppctl(['show', 'hardware', tmpif[1], 'detail'])
match = re.search(r'pci address:\s*([\d:\.]+)', output[0])
@@ -106,7 +116,10 @@ class VppDpdkVhost(IVSwitch, tasks.Process):
cli_args = []
for cfg_key in args:
cli_args.append(cfg_key)
- cli_args.append("{{ {} }}".format(' '.join(args[cfg_key])))
+ if isinstance(args[cfg_key], str):
+ cli_args.append(args[cfg_key])
+ else:
+ cli_args.append("{{ {} }}".format(' '.join(args[cfg_key])))
self._logger.debug("VPP CLI args: %s", cli_args)
return cli_args
@@ -214,7 +227,9 @@ class VppDpdkVhost(IVSwitch, tasks.Process):
socket_name = S.getValue('TOOLS')['ovs_var_tmp'] + 'dpdkvhostuser' + str(len(self._virt_ports))
output = self.run_vppctl(['create', 'vhost-user', 'socket', socket_name, 'server'] +
S.getValue('VSWITCH_VPP_VHOSTUSER_ARGS'))
- nic_name = output[0]
+ if output[0].find('returned') >= 0:
+ raise RuntimeError('VPP VhostUser interface cannot be created.')
+ nic_name = output[0].strip()
self._virt_ports.append(nic_name)
self.run_vppctl(['set', 'int', 'state', nic_name, 'up'])
return (nic_name, None)
@@ -377,6 +392,23 @@ class VppDpdkVhost(IVSwitch, tasks.Process):
return not (port_name in self._phy_ports or port_name in self._virt_ports)
# pylint: disable=no-self-use
+ def validate_add_connection(self, dummy_result, dummy_switch_name, dummy_port1,
+ dummy_port2, dummy_bidir=False):
+ """ Validate that connection was added
+ """
+ return True
+
+ def validate_del_connection(self, dummy_result, dummy_switch_name, dummy_port1,
+ dummy_port2, dummy_bidir=False):
+ """ Validate that connection was deleted
+ """
+ return True
+
+ def validate_dump_connections(self, dummy_result, dummy_switch_name):
+ """ Validate dump connections call
+ """
+ return True
+
def validate_run_vppctl(self, result, dummy_args, dummy_check_error=False):
"""validate execution of ``vppctl`` with supplied arguments.
"""