X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FVppConfigGenerator.py;h=ad3f23483e10a0ba6dcd001c9955928efc928ca8;hb=1401010f961b48323f80d30aab51d5fc2d356442;hp=24fb8ce86f9905b407fdfdba2e578249afdeff94;hpb=dc1db8f3e4eb967cfce635ba8ff06a0cf4df5390;p=csit.git diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py index 24fb8ce86f..ad3f23483e 100644 --- a/resources/libraries/python/VppConfigGenerator.py +++ b/resources/libraries/python/VppConfigGenerator.py @@ -58,7 +58,14 @@ dpdk {{ }} {pciconfig} {nomultiseg} +{enablevhostuser} }} + +ip6 {{ + hash-buckets 2000000 + heap-size 500m +}} + """ # End VPP configuration template. @@ -209,6 +216,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 +325,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 +365,7 @@ class VppConfigGenerator(object): rxqueuesconfig = "" txqueuesconfig = "" nomultiseg = "" + enablevhostuser = "" if hostname in self._nodeconfig: cfg = self._nodeconfig[hostname] @@ -346,13 +388,17 @@ 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))