diff options
author | pmikus <pmikus@cisco.com> | 2016-07-18 07:06:23 +0100 |
---|---|---|
committer | Miroslav Miklus <mmiklus@cisco.com> | 2016-07-19 12:21:37 +0000 |
commit | 380372ddefef7b3fdaef53978479142d4a13c5ef (patch) | |
tree | 00f46067abc573b2f2905f56f758f692f7a820cb /resources/libraries/python | |
parent | 369ad9d7c3078a563b3cd93cb7151104d019a085 (diff) |
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 <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r-- | resources/libraries/python/VppConfigGenerator.py | 43 |
1 files changed, 41 insertions, 2 deletions
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)) |