X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FVppConfigGenerator.py;h=267c47845ff9294bc590bb48f856109aaabaab89;hb=refs%2Fchanges%2F54%2F4454%2F96;hp=de1f0c7e5c19cfc52949b20a778659add7c9f22b;hpb=1ab4252ce00ae64648c4c8e66e6db63140253b8b;p=csit.git diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py index de1f0c7e5c..267c47845f 100644 --- a/resources/libraries/python/VppConfigGenerator.py +++ b/resources/libraries/python/VppConfigGenerator.py @@ -57,9 +57,17 @@ dpdk {{ {txqueuesconfig} }} {pciconfig} + {cryptodevconfig} + {uiodriverconfig} {nomultiseg} {enablevhostuser} }} + +ip6 {{ + hash-buckets 2000000 + heap-size 3G +}} + """ # End VPP configuration template. @@ -229,6 +237,40 @@ class VppConfigGenerator(object): logger.debug('Setting hostname {} config with {}'.\ format(hostname, "enable-vhost-user")) + def add_cryptodev_config(self, node, count): + """Add cryptodev configuration for node. + + :param node: DUT node. + :param count: Number of crypto device to add. + :type node: dict + :type count: int + :returns: nothing + :raises ValueError: If node type is not a DUT + """ + if node['type'] != NodeType.DUT: + raise ValueError('Node type is not a DUT') + hostname = Topology.get_node_hostname(node) + if hostname not in self._nodeconfig: + self._nodeconfig[hostname] = {} + + cryptodev = Topology.get_cryptodev(node) + cryptodev_config = 'enable-cryptodev' + + for i in range(count): + cryptodev_config += ' dev {}'.format(\ + re.sub(r'\d.\d$', '1.'+str(i), cryptodev)) + + self._nodeconfig[hostname]['cryptodev_config'] = cryptodev_config + logger.debug('Setting hostname {} Cryptodev config to {}'. + format(hostname, cryptodev_config)) + + uio_driver_config = 'uio-driver {}'.\ + format(Topology.get_uio_driver(node)) + + self._nodeconfig[hostname]['uio_driver_config'] = uio_driver_config + logger.debug('Setting hostname {} uio_driver config to {}'. + format(hostname, uio_driver_config)) + def remove_all_pci_devices(self, node): """Remove PCI device configuration from node. @@ -274,6 +316,22 @@ class VppConfigGenerator(object): logger.debug('Clearing Socket Memory config for hostname {}.'. format(hostname)) + def remove_cryptodev_config(self, node): + """Remove Cryptodev configuration from node. + + :param node: DUT node. + :type node: dict + :returns: nothing + :raises ValueError: If node type is not a DUT + """ + 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].pop('cryptodev_config', None) + logger.debug('Clearing Cryptodev config for hostname {}.'. + format(hostname)) + def remove_heapsize_config(self, node): """Remove Heap Size configuration from node. @@ -360,6 +418,8 @@ class VppConfigGenerator(object): txqueuesconfig = "" nomultiseg = "" enablevhostuser = "" + cryptodevconfig = "" + uiodriverconfig = "" if hostname in self._nodeconfig: cfg = self._nodeconfig[hostname] @@ -372,6 +432,12 @@ class VppConfigGenerator(object): if 'socketmem_config' in cfg: socketmemconfig = cfg['socketmem_config'] + if 'cryptodev_config' in cfg: + cryptodevconfig = cfg['cryptodev_config'] + + if 'uio_driver_config' in cfg: + uiodriverconfig = cfg['uio_driver_config'] + if 'heapsize_config' in cfg: heapsizeconfig = "\nheapsize {}\n".\ format(cfg['heapsize_config']) @@ -387,6 +453,8 @@ class VppConfigGenerator(object): vppconfig = VPP_CONFIG_TEMPLATE.format(cpuconfig=cpuconfig, pciconfig=pciconfig, + cryptodevconfig=cryptodevconfig, + uiodriverconfig=uiodriverconfig, socketmemconfig=socketmemconfig, heapsizeconfig=heapsizeconfig, rxqueuesconfig=rxqueuesconfig, @@ -418,9 +486,9 @@ class VppConfigGenerator(object): # Instead of restarting, we'll do separate start and stop # actions. This way we don't care whether VPP was running # to begin with. - ssh.exec_command('sudo initctl stop {}'.format(VPP_SERVICE_NAME)) + ssh.exec_command('sudo service {} stop'.format(VPP_SERVICE_NAME)) (ret, stdout, stderr) = \ - ssh.exec_command('sudo initctl start {}'.format(VPP_SERVICE_NAME)) + ssh.exec_command('sudo service {} start'.format(VPP_SERVICE_NAME)) if ret != 0: logger.debug('Restarting VPP failed on node {}'. format(hostname))