From 42d1016e92cf2b8ba4e493d878c475de325a447a Mon Sep 17 00:00:00 2001 From: pmikus Date: Tue, 18 Aug 2020 09:57:26 +0000 Subject: Framework: Qemu alignments Signed-off-by: pmikus Change-Id: I20098fca8fb513accef3edc9a72bfd3c56bf9be2 --- resources/libraries/python/QemuUtils.py | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'resources/libraries/python/QemuUtils.py') diff --git a/resources/libraries/python/QemuUtils.py b/resources/libraries/python/QemuUtils.py index bb0c20c554..a1482752f1 100644 --- a/resources/libraries/python/QemuUtils.py +++ b/resources/libraries/python/QemuUtils.py @@ -143,7 +143,7 @@ class QemuUtils: def add_net_user(self): """Set managment port forwarding.""" self._params.add_with_value( - u"netdev", f"user,id=mgmt,net=192.168.76.0/24," + u"netdev", f"user,id=mgmt,net=172.16.255.0/24," f"hostfwd=tcp::{self._vm_info[u'port']}-:22" ) self._params.add_with_value( @@ -171,14 +171,17 @@ class QemuUtils: u"serial", f"file:{self._temp.get(u'log')}" ) - def add_drive_cdrom(self, drive_file): + def add_drive_cdrom(self, drive_file, index=None): """Set CD-ROM drive. :param drive_file: Path to drive image. + :param index: Drive index. :type drive_file: str + :type index: int """ + index = f"index={index}," if index else u"" self._params.add_with_value( - u"drive", f"file={drive_file},media=cdrom" + u"drive", f"file={drive_file},{index}media=cdrom" ) def add_drive(self, drive_file, drive_format): @@ -291,16 +294,16 @@ class QemuUtils: vpp_config.add_unix_cli_listen() vpp_config.add_unix_exec(running) vpp_config.add_socksvr() + vpp_config.add_statseg_per_node_counters(value=u"on") vpp_config.add_buffers_per_numa(107520) + vpp_config.add_heapsize(u"1G") + vpp_config.add_ip_heap_size(u"1G") + vpp_config.add_statseg_size(u"1G") vpp_config.add_cpu_main_core(u"0") if self._opt.get(u"smp") > 1: vpp_config.add_cpu_corelist_workers(f"1-{self._opt.get(u'smp')-1}") vpp_config.add_plugin(u"disable", u"default") vpp_config.add_plugin(u"enable", u"ping_plugin.so") - if "ipsec" in self._opt.get(u'vnf'): - vpp_config.add_plugin(u"enable", u"crypto_native_plugin.so") - vpp_config.add_plugin(u"enable", u"crypto_ipsecmb_plugin.so") - vpp_config.add_plugin(u"enable", u"crypto_openssl_plugin.so") if "2vfpt" in self._opt.get(u'vnf'): vpp_config.add_plugin(u"enable", u"avf_plugin.so") if "vhost" in self._opt.get(u'vnf'): @@ -311,6 +314,14 @@ class QemuUtils: if not kwargs[u"jumbo_frames"]: vpp_config.add_dpdk_no_multi_seg() vpp_config.add_dpdk_no_tx_checksum_offload() + if "ipsec" in self._opt.get(u'vnf'): + vpp_config.add_plugin(u"enable", u"crypto_native_plugin.so") + vpp_config.add_plugin(u"enable", u"crypto_ipsecmb_plugin.so") + vpp_config.add_plugin(u"enable", u"crypto_openssl_plugin.so") + if "nat" in self._opt.get(u'vnf'): + vpp_config.add_nat(value=u"endpoint-dependent") + vpp_config.add_nat_max_translations_per_thread(value=655360) + vpp_config.add_plugin(u"enable", u"nat_plugin.so") vpp_config.write_config(startup) # Create VPP running configuration. @@ -406,13 +417,15 @@ class QemuUtils: """ if u"vpp" in self._opt.get(u"vnf"): self.create_kernelvm_config_vpp(**kwargs) + self.create_kernelvm_init(vnf_bin=self._opt.get(u"vnf_bin")) elif u"testpmd_io" in self._opt.get(u"vnf"): self.create_kernelvm_config_testpmd_io(**kwargs) + self.create_kernelvm_init(vnf_bin=self._opt.get(u"vnf_bin")) elif u"testpmd_mac" in self._opt.get(u"vnf"): self.create_kernelvm_config_testpmd_mac(**kwargs) + self.create_kernelvm_init(vnf_bin=self._opt.get(u"vnf_bin")) else: raise RuntimeError(u"QEMU: Unsupported VNF!") - self.create_kernelvm_init(vnf_bin=self._opt.get(u"vnf_bin")) def get_qemu_pids(self): """Get QEMU CPU pids. -- cgit 1.2.3-korg