X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FQemuManager.py;h=766372ad9c64004d537e013f786a23466e78c977;hp=547250e28386f9801f70b2f1c41a9589aa802d7d;hb=6da5a6920171682bd5bf6a77517bedfef91cbd0e;hpb=5c7cf5a09ec1cd7ebc4077981de84c4f18aa8738 diff --git a/resources/libraries/python/QemuManager.py b/resources/libraries/python/QemuManager.py index 547250e283..766372ad9c 100644 --- a/resources/libraries/python/QemuManager.py +++ b/resources/libraries/python/QemuManager.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -51,8 +51,9 @@ class QemuManager: nf_nodes = int(kwargs[u"nf_nodes"]) queues = kwargs[u"rxq_count_int"] if kwargs[u"auto_scale"] else 1 vs_dtc = kwargs[u"vs_dtc"] - nf_dtc = kwargs[u"vs_dtc"] if kwargs[u"auto_scale"] \ - else kwargs[u"nf_dtc"] + nf_dtc = kwargs[u"nf_dtc"] + if kwargs[u"auto_scale"] and not kwargs[u"fixed_auto_scale"]: + nf_dtc = kwargs[u"vs_dtc"] nf_dtcr = kwargs[u"nf_dtcr"] \ if isinstance(kwargs[u"nf_dtcr"], int) else 2 @@ -144,6 +145,8 @@ class QemuManager: """ qemu_id = kwargs[u"qemu_id"] name = kwargs[u"name"] + virtio_feature_mask = kwargs[u"virtio_feature_mask"] \ + if u"virtio_feature_mask" in kwargs else None self.machines[name] = QemuUtils( node=self.nodes[kwargs[u"node"]], @@ -168,16 +171,14 @@ class QemuManager: jumbo_frames=kwargs[u"jumbo"], queues=kwargs[u"queues"], queue_size=kwargs[u"perf_qemu_qsz"], - csum=kwargs[u"enable_csum"], - gso=kwargs[u"enable_gso"] + virtio_feature_mask=virtio_feature_mask ) self.machines[name].add_vhost_user_if( f"/run/vpp/sock-{qemu_id}-2", jumbo_frames=kwargs[u"jumbo"], queues=kwargs[u"queues"], queue_size=kwargs[u"perf_qemu_qsz"], - csum=kwargs[u"enable_csum"], - gso=kwargs[u"enable_gso"] + virtio_feature_mask=virtio_feature_mask ) def _c_vpp_2vfpt_ip4base_plen24(self, **kwargs): @@ -419,3 +420,38 @@ class QemuManager: pci=Topology.get_interface_pci_addr( self.nodes[kwargs[u"node"]], kwargs[u"if1"]) ) + + def _c_iperf3(self, **kwargs): + """Instantiate one VM with iperf3 configuration. + + :param kwargs: Named parameters. + :type kwargs: dict + """ + qemu_id = kwargs[u"qemu_id"] + name = kwargs[u"name"] + virtio_feature_mask = kwargs[u"virtio_feature_mask"] \ + if u"virtio_feature_mask" in kwargs else None + + self.machines[name] = QemuUtils( + node=self.nodes[kwargs[u"node"]], + qemu_id=qemu_id, + smp=len(self.machines_affinity[name]), + mem=4096, + vnf=kwargs[u"vnf"], + img=Constants.QEMU_VM_KERNEL + ) + self.machines[name].add_default_params() + self.machines[name].add_kernelvm_params() + self.machines[name].configure_kernelvm_vnf( + queues=kwargs[u"queues"], + jumbo_frames=kwargs[u"jumbo"] + ) + self.machines[name].add_net_user() + self.machines[name].add_vhost_user_if( + f"/run/vpp/sock-{qemu_id}-1", + server=False, + jumbo_frames=kwargs[u"jumbo"], + queues=kwargs[u"queues"], + queue_size=kwargs[u"perf_qemu_qsz"], + virtio_feature_mask=virtio_feature_mask + )