From: pmikus Date: Mon, 18 Jul 2016 06:06:23 +0000 (+0100) Subject: CSIT-209 Add option enable-vhost-user into startup config X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=commitdiff_plain;h=380372ddefef7b3fdaef53978479142d4a13c5ef;hp=369ad9d7c3078a563b3cd93cb7151104d019a085 CSIT-209 Add option enable-vhost-user into startup config - Add option enable-vhost-user into startup config Change-Id: I2cf7952047ee749bd66e041b57aaee61c2687382 Signed-off-by: pmikus --- diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py index 24fb8ce86f..f255266eea 100644 --- a/resources/libraries/python/VppConfigGenerator.py +++ b/resources/libraries/python/VppConfigGenerator.py @@ -58,6 +58,7 @@ dpdk {{ }} {pciconfig} {nomultiseg} +{enablevhostuser} }} """ # End VPP configuration template. @@ -209,6 +210,25 @@ class VppConfigGenerator(object): logger.debug('Setting hostname {} config with {}'.\ format(hostname, "no-multi-seg")) + def add_enable_vhost_user_config(self, node): + """Add enable-vhost-user configuration for node. + + :param node: DUT node. + :type node: dict + :return: nothing + """ + if node['type'] != NodeType.DUT: + raise ValueError('Node type is not a DUT') + hostname = Topology.get_node_hostname(node) + if not hostname in self._nodeconfig: + self._nodeconfig[hostname] = {} + if not 'enable_vhost_user' in self._nodeconfig[hostname]: + self._nodeconfig[hostname]['enable_vhost_user'] = [] + self._nodeconfig[hostname]['enable_vhost_user'].append( + "enable-vhost-user") + logger.debug('Setting hostname {} config with {}'.\ + format(hostname, "enable-vhost-user")) + def remove_all_pci_devices(self, node): """Remove PCI device configuration from node. @@ -299,6 +319,21 @@ class VppConfigGenerator(object): logger.debug('Clearing No Multi Seg config for hostname {}.'.\ format(hostname)) + def remove_enable_vhost_user_config(self, node): + """Remove enable-vhost-user configuration from node. + + :param node: DUT node. + :type node: dict + :return: nothing + """ + if node['type'] != NodeType.DUT: + raise ValueError('Node type is not a DUT') + hostname = Topology.get_node_hostname(node) + if hostname in self._nodeconfig: + self._nodeconfig[hostname]['enable_vhost_user'] = [] + logger.debug('Clearing enable-vhost-user config for hostname {}.'.\ + format(hostname)) + def apply_config(self, node, waittime=5, retries=12): """Generate and apply VPP configuration for node. @@ -324,6 +359,7 @@ class VppConfigGenerator(object): rxqueuesconfig = "" txqueuesconfig = "" nomultiseg = "" + enablevhostuser = "" if hostname in self._nodeconfig: cfg = self._nodeconfig[hostname] @@ -346,13 +382,16 @@ class VppConfigGenerator(object): if 'no_multi_seg_config' in cfg: nomultiseg = " " + "\n ".join(cfg['no_multi_seg_config']) + if 'enable_vhost_user' in cfg: + enablevhostuser = " " + "\n ".join(cfg['enable_vhost_user']) + vppconfig = VPP_CONFIG_TEMPLATE.format(cpuconfig=cpuconfig, pciconfig=pciconfig, socketmemconfig=socketmemconfig, - heapsizeconfig=heapsizeconfig, rxqueuesconfig=rxqueuesconfig, txqueuesconfig=txqueuesconfig, - nomultiseg = nomultiseg) + nomultiseg=nomultiseg, + enablevhostuser=enablevhostuser) logger.debug('Writing VPP config to host {}: "{}"'.format(hostname, vppconfig)) diff --git a/resources/libraries/robot/default.robot b/resources/libraries/robot/default.robot index 6591b3c874..ad5d69dfed 100644 --- a/resources/libraries/robot/default.robot +++ b/resources/libraries/robot/default.robot @@ -114,6 +114,13 @@ | | :FOR | ${dut} | IN | @{duts} | | | Add No Multi Seg Config | ${nodes['${dut}']} +| Add Enable Vhost User to all DUTs +| | [Documentation] | Add Enable Vhost User to VPP startup configuration to all +| | ... | DUTs +| | ${duts}= | Get Matches | ${nodes} | DUT* +| | :FOR | ${dut} | IN | @{duts} +| | | Add Enable Vhost User Config | ${nodes['${dut}']} + | Remove startup configuration of VPP from all DUTs | | [Documentation] | Remove VPP startup configuration from all DUTs | | ${duts}= | Get Matches | ${nodes} | DUT* @@ -124,6 +131,7 @@ | | | Remove Heapsize Config | ${nodes['${dut}']} | | | Remove Rxqueues Config | ${nodes['${dut}']} | | | Remove No Multi Seg Config | ${nodes['${dut}']} +| | | Remove Enable Vhost User Config | ${nodes['${dut}']} | Setup default startup configuration of VPP on all DUTs | | [Documentation] | Setup default startup configuration of VPP to all DUTs