- pmd_nb_cores = '--nb-cores={} '.format(\
- bin(int(args['eal_coremask'], 0) & 0xFFFE).count('1'))\
- if args.get('eal_coremask', '') else ''
- eal_options = '-v '\
- + eal_coremask\
- + eal_mem_channels\
- + eal_socket_mem\
- + eal_driver
- pmd_options = '-- '\
- + pmd_fwd_mode\
- + pmd_burst\
- + pmd_txd\
- + pmd_rxd\
- + pmd_txqflags\
- + pmd_total_num_mbufs\
- + pmd_portmask\
- + pmd_disable_hw_vlan\
- + pmd_disable_rss\
- + pmd_coremask\
- + pmd_nb_cores
- ssh = SSH()
- ssh.connect(node)
- cmd = "/start-testpmd.sh {0} {1}".format(eal_options, pmd_options)
- exec_cmd_no_error(node, cmd, sudo=True)
- ssh.disconnect(node)
+ options.add_equals_from_dict(u"nb-cores", u"pmd_nb_cores", kwargs)
+ return options
+
+ @staticmethod
+ def get_testpmd_cmdline(**kwargs):
+ """Get DPDK testpmd command line arguments.
+
+ :param kwargs: Key-value testpmd parameters.
+ :type kwargs: dict
+ :returns: Command line string.
+ :rtype: OptionString
+ """
+ options = OptionString()
+ options.add(u"testpmd")
+ options.extend(DpdkUtil.get_eal_options(**kwargs))
+ options.add(u"--")
+ options.extend(DpdkUtil.get_pmd_options(**kwargs))
+ return options
+
+ @staticmethod
+ def dpdk_testpmd_start(node, **kwargs):
+ """Start DPDK testpmd app on VM node.
+
+ :param node: VM Node to start testpmd on.
+ :param kwargs: Key-value testpmd parameters.
+ :type node: dict
+ :type kwargs: dict
+ """
+ cmd_options = OptionString()
+ cmd_options.add(u"/start-testpmd.sh")
+ cmd_options.extend(DpdkUtil.get_eal_options(**kwargs))
+ cmd_options.add(u"--")
+ cmd_options.extend(DpdkUtil.get_pmd_options(**kwargs))
+ exec_cmd_no_error(node, cmd_options, sudo=True, disconnect=True)