[v3,2/3] update files depending on tests/util

Message ID 20220413145437.31526-2-ohilyard@iol.unh.edu (mailing list archive)
State Superseded
Headers
Series [v3,1/3] framework: Move test-specific files to test directory |

Commit Message

Owen Hilyard April 13, 2022, 2:54 p.m. UTC
  From: Owen Hilyard <ohilyard@iol.unh.edu>

All of these files imported something that has been moved from
framework/ to tests/util/. Unused imports have been removed as part of
updating the import paths.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
 framework/dut.py                              |  2 +-
 framework/multiple_vm.py                      |  4 +--
 tests/TestSuite_ddp_gtp.py                    |  4 +--
 tests/TestSuite_ddp_mpls.py                   |  7 +-----
 tests/TestSuite_dpdk_gro_lib.py               |  2 +-
 tests/TestSuite_dpdk_gso_lib.py               |  3 +--
 tests/TestSuite_floating_veb.py               |  5 ----
 tests/TestSuite_flow_classify_softnic.py      | 24 +++---------------
 tests/TestSuite_generic_flow_api.py           | 10 --------
 tests/TestSuite_iavf.py                       |  7 ++----
 tests/TestSuite_ip_pipeline.py                | 25 +++----------------
 ...te_ixgbe_vf_get_extra_queue_information.py |  6 +----
 tests/TestSuite_kernelpf_iavf.py              |  4 +--
 tests/TestSuite_mdd.py                        |  4 +--
 tests/TestSuite_pipeline.py                   | 24 +++---------------
 tests/TestSuite_port_control.py               |  4 +--
 tests/TestSuite_power_bidirection_channel.py  |  2 +-
 tests/TestSuite_power_negative.py             |  6 +----
 tests/TestSuite_pvp_diff_qemu_version.py      |  5 +---
 ...Suite_pvp_qemu_multi_paths_port_restart.py |  3 +--
 tests/TestSuite_pvp_vhost_user_reconnect.py   |  2 +-
 tests/TestSuite_pvp_virtio_bonding.py         |  2 +-
 tests/TestSuite_rte_flow.py                   |  5 +---
 tests/TestSuite_runtime_vf_queue_number.py    |  2 +-
 ...estSuite_runtime_vf_queue_number_kernel.py |  2 +-
 tests/TestSuite_shutdown_api.py               |  6 ++---
 tests/TestSuite_sriov_kvm.py                  |  6 +----
 tests/TestSuite_vdev_primary_secondary.py     |  2 +-
 tests/TestSuite_veb_switch.py                 |  5 ----
 tests/TestSuite_vf_daemon.py                  |  7 +-----
 tests/TestSuite_vf_interrupt_pmd.py           |  6 +----
 tests/TestSuite_vf_jumboframe.py              |  5 +---
 tests/TestSuite_vf_kernel.py                  |  4 +--
 tests/TestSuite_vf_macfilter.py               |  3 +--
 tests/TestSuite_vf_offload.py                 |  7 +-----
 tests/TestSuite_vf_packet_rxtx.py             |  3 +--
 tests/TestSuite_vf_port_start_stop.py         |  3 +--
 tests/TestSuite_vf_rss.py                     |  2 +-
 tests/TestSuite_vf_to_vf_nic_bridge.py        |  3 +--
 tests/TestSuite_vf_vlan.py                    |  4 +--
 tests/TestSuite_vhost_event_idx_interrupt.py  |  3 +--
 tests/TestSuite_vhost_multi_queue_qemu.py     |  2 +-
 tests/TestSuite_vhost_pmd_xstats.py           |  4 ---
 tests/TestSuite_vhost_user_live_migration.py  |  3 +--
 tests/TestSuite_vhost_virtio_pmd_interrupt.py |  2 +-
 tests/TestSuite_virtio_event_idx_interrupt.py |  3 +--
 .../TestSuite_virtio_ipsec_cryptodev_func.py  |  5 +---
 tests/TestSuite_virtio_perf_cryptodev_func.py |  5 +---
 tests/TestSuite_virtio_pvp_regression.py      |  3 +--
 tests/TestSuite_virtio_unit_cryptodev_func.py |  6 +----
 tests/TestSuite_vm2vm_virtio_net_perf.py      |  2 +-
 tests/TestSuite_vm2vm_virtio_pmd.py           |  2 +-
 tests/TestSuite_vm_hotplug.py                 |  2 +-
 tests/TestSuite_vm_power_manager.py           |  3 +--
 tests/TestSuite_vm_pw_mgmt_policy.py          |  3 +--
 tests/TestSuite_vswitch_sample_cbdma.py       |  2 +-
 {framework => tests/util/virt}/qemu_kvm.py    |  8 +++---
 .../util/virt}/qemu_libvirt.py                | 11 ++------
 tests/util/virt/virt_common.py                |  4 +--
 tests/util/virt/virt_scene.py                 |  5 ++--
 60 files changed, 74 insertions(+), 234 deletions(-)
 rename {framework => tests/util/virt}/qemu_kvm.py (99%)
 rename {framework => tests/util/virt}/qemu_libvirt.py (99%)
  

Comments

Juraj Linkeš April 14, 2022, 5:40 a.m. UTC | #1
> diff --git a/framework/dut.py b/framework/dut.py index 6a8fc957..83f0d7a2
> 100644
> --- a/framework/dut.py
> +++ b/framework/dut.py
> @@ -46,7 +46,7 @@ from .settings import LOG_NAME_SEP, NICS  from
> .ssh_connection import SSHConnection  from .test_result import ResultTable
> from .utils import RED, remove_old_rsa_key -from .virt_resource import
> VirtResource
> +from framework.virt_resource import VirtResource

And this also didn't get addressed, I guess you just added the commit in v3.
  
Owen Hilyard April 14, 2022, 7:53 p.m. UTC | #2
I moved the files over and ran the formatter, which produced a diff large
enough that the mailing list rejected it when I bundled it with the first
commit. I could split things up more, but that would lead to an extra 2 or
3 patches in this series that contain formatting unrelated to the problem,
simply because unformatted patches are getting merged. I hadn't anticipated
needing granularity in the formatter because nothing except what you just
worked on was supposed to be changing when you ran it, and the tools we're
using don't support parts of a file.

I don't want to have to keep submitting "ran the formatter" patches every
week or two, since that will lead to a very messy git history.  I could
submit one more and rebase this series on top of it, which would let me
send it in as two organized commits. Thoughts?

On Thu, Apr 14, 2022 at 1:40 AM Juraj Linkeš <juraj.linkes@pantheon.tech>
wrote:

>
> > diff --git a/framework/dut.py b/framework/dut.py index 6a8fc957..83f0d7a2
> > 100644
> > --- a/framework/dut.py
> > +++ b/framework/dut.py
> > @@ -46,7 +46,7 @@ from .settings import LOG_NAME_SEP, NICS  from
> > .ssh_connection import SSHConnection  from .test_result import
> ResultTable
> > from .utils import RED, remove_old_rsa_key -from .virt_resource import
> > VirtResource
> > +from framework.virt_resource import VirtResource
>
> And this also didn't get addressed, I guess you just added the commit in
> v3.
>
>
  
Juraj Linkeš April 20, 2022, 8:45 a.m. UTC | #3
From: Owen Hilyard <ohilyard@iol.unh.edu>
Sent: Thursday, April 14, 2022 9:54 PM
To: Juraj Linkeš <juraj.linkes@pantheon.tech>
Cc: dts@dpdk.org; lijuan.tu@intel.com
Subject: Re: [PATCH v3 2/3] update files depending on tests/util

I moved the files over and ran the formatter, which produced a diff large enough that the mailing list rejected it when I bundled it with the first commit. I could split things up more, but that would lead to an extra 2 or 3 patches in this series that contain formatting unrelated to the problem, simply because unformatted patches are getting merged. I hadn't anticipated needing granularity in the formatter because nothing except what you just worked on was supposed to be changing when you ran it, and the tools we're using don't support parts of a file.

[Juraj] Well you could've just changed this one thing manually. The formatting of whole files shouldn't be done here.

I don't want to have to keep submitting "ran the formatter" patches every week or two, since that will lead to a very messy git history.  I could submit one more and rebase this series on top of it, which would let me send it in as two organized commits. Thoughts?

[Juraj] What we should do is have a system that prevents unformatted files from being accepted (I understand we formatted the  and now they're improperly formatted - that shouldn't happen, although that could be because Lijian ran format.sh without pylama config?). A CI check which we're working on is sufficient with maintainers adhering to it (i.e. notifing authors that it's indeed necessary to properly format their submissions). Once we have the CI check, only then it makes sense to reformat everything. After that, we should notify the authors of patches in review to rebase and reformat their patches.

On Thu, Apr 14, 2022 at 1:40 AM Juraj Linkeš <juraj.linkes@pantheon.tech<mailto:juraj.linkes@pantheon.tech>> wrote:

> diff --git a/framework/dut.py b/framework/dut.py index 6a8fc957..83f0d7a2
> 100644
> --- a/framework/dut.py
> +++ b/framework/dut.py
> @@ -46,7 +46,7 @@ from .settings import LOG_NAME_SEP, NICS  from
> .ssh_connection import SSHConnection  from .test_result import ResultTable
> from .utils import RED, remove_old_rsa_key -from .virt_resource import
> VirtResource
> +from framework.virt_resource import VirtResource

And this also didn't get addressed, I guess you just added the commit in v3.
  

Patch

diff --git a/framework/dut.py b/framework/dut.py
index 6a8fc957..83f0d7a2 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -46,7 +46,7 @@  from .settings import LOG_NAME_SEP, NICS
 from .ssh_connection import SSHConnection
 from .test_result import ResultTable
 from .utils import RED, remove_old_rsa_key
-from .virt_resource import VirtResource
+from framework.virt_resource import VirtResource
 
 
 class Dut(Crb):
diff --git a/framework/multiple_vm.py b/framework/multiple_vm.py
index aac8f160..985dea7f 100644
--- a/framework/multiple_vm.py
+++ b/framework/multiple_vm.py
@@ -1,4 +1,3 @@ 
-import re
 import threading
 import time
 import traceback
@@ -7,7 +6,6 @@  import threadpool
 
 from .logger import getLogger
 from .settings import DTS_ERR_TBL, DTS_PARALLEL_SETTING, save_global_setting
-from .utils import RED
 
 
 class MultipleVM(object):
@@ -79,7 +77,7 @@  class MultipleVM(object):
         self.logger.info("Parallel task start for DUT%d %s" % (dut_id, vm_name))
         threading.current_thread().name = vm_name
 
-        from .qemu_kvm import QEMUKvm
+        from tests.util.virt.qemu_kvm import QEMUKvm
 
         # VM configured by configuration file
         if "virt_config" in args:
diff --git a/tests/TestSuite_ddp_gtp.py b/tests/TestSuite_ddp_gtp.py
index f6ceb5b4..7b1b4f81 100644
--- a/tests/TestSuite_ddp_gtp.py
+++ b/tests/TestSuite_ddp_gtp.py
@@ -31,13 +31,11 @@ 
 
 import random
 import re
-import sys
 import time
 
 import framework.utils as utils
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
-from framework.settings import get_nic_name
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.test_case import TestCase
 
 VM_CORES_MASK = "all"
diff --git a/tests/TestSuite_ddp_mpls.py b/tests/TestSuite_ddp_mpls.py
index 9b1179be..0ab4cb6c 100644
--- a/tests/TestSuite_ddp_mpls.py
+++ b/tests/TestSuite_ddp_mpls.py
@@ -30,15 +30,10 @@ 
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import random
-import sys
 import time
 
-from scapy.utils import rdpcap
-
-import framework.utils as utils
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
-from framework.settings import get_nic_name
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.test_case import TestCase
 
 VM_CORES_MASK = "all"
diff --git a/tests/TestSuite_dpdk_gro_lib.py b/tests/TestSuite_dpdk_gro_lib.py
index e19b3695..87af21ca 100644
--- a/tests/TestSuite_dpdk_gro_lib.py
+++ b/tests/TestSuite_dpdk_gro_lib.py
@@ -42,7 +42,7 @@  import time
 import framework.utils as utils
 import tests.vhost_peer_conf as peer
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestDPDKGROLib(TestCase):
diff --git a/tests/TestSuite_dpdk_gso_lib.py b/tests/TestSuite_dpdk_gso_lib.py
index 25293643..6b7c86f1 100644
--- a/tests/TestSuite_dpdk_gso_lib.py
+++ b/tests/TestSuite_dpdk_gso_lib.py
@@ -41,9 +41,8 @@  import time
 
 import framework.utils as utils
 import tests.vhost_peer_conf as peer
-from framework.config import UserConf
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestDPDKGsoLib(TestCase):
diff --git a/tests/TestSuite_floating_veb.py b/tests/TestSuite_floating_veb.py
index c3c0f83c..3d2e44eb 100644
--- a/tests/TestSuite_floating_veb.py
+++ b/tests/TestSuite_floating_veb.py
@@ -38,14 +38,9 @@  Test Floating VEB Features by Poll Mode Drivers.
 import re
 import time
 
-from framework.dut import Dut
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.project_dpdk import DPDKdut
-from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.utils import RED
-from framework.virt_dut import VirtDut
 
 
 class TestFloatingVEBSwitching(TestCase):
diff --git a/tests/TestSuite_flow_classify_softnic.py b/tests/TestSuite_flow_classify_softnic.py
index 14042d18..d0f35b82 100644
--- a/tests/TestSuite_flow_classify_softnic.py
+++ b/tests/TestSuite_flow_classify_softnic.py
@@ -29,33 +29,17 @@ 
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import os
-import random
 import re
 import time
 from time import sleep
 
-import scapy.layers.inet
-from scapy.arch import get_if_hwaddr
-from scapy.layers.inet import ICMP, IP, TCP, UDP, Ether
+from scapy.layers.inet import IP, TCP, UDP, Ether
 from scapy.layers.inet6 import IPv6
-from scapy.layers.l2 import ARP, GRE, Dot1Q
-from scapy.layers.sctp import SCTP, SCTPChunkData
-from scapy.packet import Raw, bind_layers
-from scapy.route import *
-from scapy.sendrecv import sendp, sniff
-from scapy.utils import hexstr, rdpcap, wrpcap
-
-import framework.utils as utils
-from framework.crb import Crb
-from framework.dut import Dut
-from framework.exception import VerifyFailure
-from framework.packet import Packet
+from scapy.layers.sctp import SCTP
+from scapy.utils import rdpcap, wrpcap
+
 from framework.pmd_output import PmdOutput
-from framework.project_dpdk import DPDKdut
-from framework.settings import DRIVERS, HEADER_SIZE
 from framework.test_case import TestCase
-from framework.virt_dut import VirtDut
 
 
 class TestFlowClassifySoftnic(TestCase):
diff --git a/tests/TestSuite_generic_flow_api.py b/tests/TestSuite_generic_flow_api.py
index a87f3f8b..998edc46 100644
--- a/tests/TestSuite_generic_flow_api.py
+++ b/tests/TestSuite_generic_flow_api.py
@@ -36,24 +36,14 @@  Test the support of generic flow API by Poll Mode Drivers.
 
 """
 
-import os
 import random
 import re
 import time
 
-import scapy.layers.inet
-from scapy.utils import rdpcap
-
 import framework.packet as packet
 import framework.utils as utils
-from framework.crb import Crb
-from framework.dut import Dut
-from framework.exception import VerifyFailure
 from framework.pmd_output import PmdOutput
-from framework.project_dpdk import DPDKdut
-from framework.settings import DRIVERS, HEADER_SIZE
 from framework.test_case import TestCase, check_supported_nic
-from framework.virt_dut import VirtDut
 
 MAX_VLAN = 4095
 MAX_QUEUE = 15
diff --git a/tests/TestSuite_iavf.py b/tests/TestSuite_iavf.py
index d52996d2..15dfba08 100644
--- a/tests/TestSuite_iavf.py
+++ b/tests/TestSuite_iavf.py
@@ -36,16 +36,13 @@  Test some iavf function in i40e driver
 
 """
 
-import math
-import random
 import re
 import time
 
-from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.settings import HEADER_SIZE, get_nic_name
+from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "Default"
 
diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
index e5720e74..efed9672 100644
--- a/tests/TestSuite_ip_pipeline.py
+++ b/tests/TestSuite_ip_pipeline.py
@@ -29,34 +29,17 @@ 
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import os
-import random
 import re
 import time
 from time import sleep
 
-import scapy.layers.inet
-from scapy.arch import get_if_hwaddr
-from scapy.layers.inet import ICMP, IP, TCP, UDP, Ether
-from scapy.layers.l2 import ARP, GRE, Dot1Q
-from scapy.layers.sctp import SCTP, SCTPChunkData
-from scapy.packet import Raw, bind_layers
-from scapy.route import *
-from scapy.sendrecv import sendp, sniff
+from scapy.layers.inet import IP, TCP, Ether
+from scapy.packet import Raw
 
 # from scapy.all import conf
-from scapy.utils import hexstr, rdpcap, wrpcap
-
-import framework.utils as utils
-from framework.crb import Crb
-from framework.dut import Dut
-from framework.exception import VerifyFailure
-from framework.packet import Packet
-from framework.pmd_output import PmdOutput
-from framework.project_dpdk import DPDKdut
-from framework.settings import DRIVERS, HEADER_SIZE
+from scapy.utils import rdpcap, wrpcap
+
 from framework.test_case import TestCase
-from framework.virt_dut import VirtDut
 
 
 class TestIPPipeline(TestCase):
diff --git a/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
index 0e64a5d6..2fa2974f 100644
--- a/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
+++ b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
@@ -33,18 +33,14 @@ 
 DPDK Test suite.
 Test Niantic ixgbe_get_vf_queue Include Extra Information function.
 """
-import random
-import re
 import time
 
-import framework.utils as utils
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
+from tests.util.virt.qemu_kvm import QEMUKvm
 
 # Use scapy to send packets with different source and dest ip.
 # and collect the hash result of five tuple and the queue id.
 from framework.test_case import TestCase
-from framework.virt_common import VM
 
 
 class TestIxgbeVfGetExtraInfo(TestCase):
diff --git a/tests/TestSuite_kernelpf_iavf.py b/tests/TestSuite_kernelpf_iavf.py
index 3c8e5929..55e40630 100644
--- a/tests/TestSuite_kernelpf_iavf.py
+++ b/tests/TestSuite_kernelpf_iavf.py
@@ -44,10 +44,8 @@  import time
 import framework.utils as utils
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.utils import RED
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "all"
 MAX_VLAN = 4095
diff --git a/tests/TestSuite_mdd.py b/tests/TestSuite_mdd.py
index dc28b9fe..43049974 100644
--- a/tests/TestSuite_mdd.py
+++ b/tests/TestSuite_mdd.py
@@ -34,14 +34,12 @@  DPDK Test suite.
 Test the support of Malicious Driver Detection
 """
 
-
-import re
 import time
 
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "all"
 send_pks_num = 2000
diff --git a/tests/TestSuite_pipeline.py b/tests/TestSuite_pipeline.py
index c13bd714..b36d62e9 100644
--- a/tests/TestSuite_pipeline.py
+++ b/tests/TestSuite_pipeline.py
@@ -31,34 +31,18 @@ 
 
 import itertools
 import os
-import random
 import re
 import socket
 import time
 from time import sleep
 
-import scapy.layers.inet
-from scapy.arch import get_if_hwaddr
-from scapy.layers.inet import ICMP, IP, TCP, UDP, Ether
-from scapy.layers.l2 import ARP, GRE, Dot1Q
-from scapy.layers.sctp import SCTP, SCTPChunkData
-from scapy.packet import Raw, bind_layers
-from scapy.route import *
-from scapy.sendrecv import sendp, sniff
+from scapy.layers.inet import IP, TCP, Ether
+from scapy.packet import Raw
 
 # from scapy.all import conf
-from scapy.utils import hexstr, rdpcap, wrpcap
-
-import framework.utils as utils
-from framework.crb import Crb
-from framework.dut import Dut
-from framework.exception import VerifyFailure
-from framework.packet import Packet
-from framework.pmd_output import PmdOutput
-from framework.project_dpdk import DPDKdut
-from framework.settings import DRIVERS, HEADER_SIZE
+from scapy.utils import rdpcap, wrpcap
+
 from framework.test_case import TestCase
-from framework.virt_dut import VirtDut
 
 TIMESTAMP = re.compile(r"\d{2}\:\d{2}\:\d{2}\.\d{6}")
 PAYLOAD = re.compile(r"\t0x([0-9a-fA-F]+):  ([0-9a-fA-F ]+)")
diff --git a/tests/TestSuite_port_control.py b/tests/TestSuite_port_control.py
index 8055b776..fce2c523 100755
--- a/tests/TestSuite_port_control.py
+++ b/tests/TestSuite_port_control.py
@@ -29,15 +29,13 @@ 
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import os
 import re
 import time
 
 import framework.packet as packet
-import framework.utils as utils
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestPortControl(TestCase):
diff --git a/tests/TestSuite_power_bidirection_channel.py b/tests/TestSuite_power_bidirection_channel.py
index 1f2dcd1d..b8a5e028 100644
--- a/tests/TestSuite_power_bidirection_channel.py
+++ b/tests/TestSuite_power_bidirection_channel.py
@@ -38,7 +38,7 @@  import time
 import traceback
 
 from framework.exception import VerifyFailure
-from framework.qemu_libvirt import LibvirtKvm
+from tests.util.virt.qemu_libvirt import LibvirtKvm
 from framework.test_case import TestCase
 from framework.utils import create_mask as dts_create_mask
 
diff --git a/tests/TestSuite_power_negative.py b/tests/TestSuite_power_negative.py
index b1ca3ebd..2d98d8a6 100644
--- a/tests/TestSuite_power_negative.py
+++ b/tests/TestSuite_power_negative.py
@@ -35,14 +35,10 @@  power negative test suite.
 """
 
 import os
-import re
 import time
-import traceback
 
-from framework.exception import VerifyFailure
-from framework.qemu_libvirt import LibvirtKvm
+from tests.util.virt.qemu_libvirt import LibvirtKvm
 from framework.test_case import TestCase
-from framework.utils import create_mask as dts_create_mask
 
 
 class TestPowerNegative(TestCase):
diff --git a/tests/TestSuite_pvp_diff_qemu_version.py b/tests/TestSuite_pvp_diff_qemu_version.py
index b1fb18ae..eac63a63 100644
--- a/tests/TestSuite_pvp_diff_qemu_version.py
+++ b/tests/TestSuite_pvp_diff_qemu_version.py
@@ -41,13 +41,10 @@  qemu =
 import re
 import time
 
-from scapy.utils import wrpcap
-
-import framework.utils as utils
 from framework.pktgen import PacketGeneratorHelper
 from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVhostPVPDiffQemuVersion(TestCase):
diff --git a/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
index 0a5dcdd2..855d4251 100644
--- a/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
+++ b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
@@ -41,11 +41,10 @@  port restart test with each path
 import re
 import time
 
-import framework.utils as utils
 from framework.packet import Packet
 from framework.pktgen import PacketGeneratorHelper
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestPVPQemuMultiPathPortRestart(TestCase):
diff --git a/tests/TestSuite_pvp_vhost_user_reconnect.py b/tests/TestSuite_pvp_vhost_user_reconnect.py
index 327444fb..ec494106 100644
--- a/tests/TestSuite_pvp_vhost_user_reconnect.py
+++ b/tests/TestSuite_pvp_vhost_user_reconnect.py
@@ -43,7 +43,7 @@  import framework.utils as utils
 from framework.packet import Packet
 from framework.pktgen import PacketGeneratorHelper
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestPVPVhostUserReconnect(TestCase):
diff --git a/tests/TestSuite_pvp_virtio_bonding.py b/tests/TestSuite_pvp_virtio_bonding.py
index 3565882e..e009a819 100644
--- a/tests/TestSuite_pvp_virtio_bonding.py
+++ b/tests/TestSuite_pvp_virtio_bonding.py
@@ -42,7 +42,7 @@  from framework.packet import Packet
 from framework.pktgen import PacketGeneratorHelper
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestPVPVirtIOBonding(TestCase):
diff --git a/tests/TestSuite_rte_flow.py b/tests/TestSuite_rte_flow.py
index b8d41540..237a2559 100644
--- a/tests/TestSuite_rte_flow.py
+++ b/tests/TestSuite_rte_flow.py
@@ -34,12 +34,9 @@ 
 DPDK Test suite.
 MTU Checks example.
 """
-import ipaddress
-import time
 from typing import Callable
 
-import framework.utils as utils
-from framework.flow import generator
+from tests.util.flow import generator
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
 
diff --git a/tests/TestSuite_runtime_vf_queue_number.py b/tests/TestSuite_runtime_vf_queue_number.py
index ae431f56..99af8710 100644
--- a/tests/TestSuite_runtime_vf_queue_number.py
+++ b/tests/TestSuite_runtime_vf_queue_number.py
@@ -39,7 +39,7 @@  import time
 
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.test_case import TestCase
 
 RSS_KEY = "6EA6A420D5138E712433B813AE45B3C4BECB2B405F31AD6C331835372D15E2D5E49566EE0ED1962AFA1B7932F3549520FD71C75E"
diff --git a/tests/TestSuite_runtime_vf_queue_number_kernel.py b/tests/TestSuite_runtime_vf_queue_number_kernel.py
index e8f9f5c9..16101c98 100755
--- a/tests/TestSuite_runtime_vf_queue_number_kernel.py
+++ b/tests/TestSuite_runtime_vf_queue_number_kernel.py
@@ -41,7 +41,7 @@  import framework.utils as utils
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "all"
 
diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py
index a109932a..9248447a 100644
--- a/tests/TestSuite_shutdown_api.py
+++ b/tests/TestSuite_shutdown_api.py
@@ -36,8 +36,6 @@  Test Shutdown API Feature
 
 """
 
-import os
-import random
 import re
 import time
 from random import randint
@@ -45,8 +43,8 @@  from random import randint
 import framework.utils as utils
 from framework.exception import VerifyFailure
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
-from framework.settings import DRIVERS, HEADER_SIZE, PROTOCOL_PACKET_SIZE, get_nic_name
+from tests.util.virt.qemu_kvm import QEMUKvm
+from framework.settings import DRIVERS, HEADER_SIZE
 from framework.test_case import TestCase
 
 #
diff --git a/tests/TestSuite_sriov_kvm.py b/tests/TestSuite_sriov_kvm.py
index c2ce2259..245eca70 100644
--- a/tests/TestSuite_sriov_kvm.py
+++ b/tests/TestSuite_sriov_kvm.py
@@ -37,15 +37,11 @@  Test userland 10Gb PMD.
 
 """
 
-import pdb
-import random
-import re
 import time
 
 from framework.pmd_output import PmdOutput
-from framework.settings import PROTOCOL_PACKET_SIZE
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 FRAME_SIZE_64 = 64
 VM_CORES_MASK = "all"
diff --git a/tests/TestSuite_vdev_primary_secondary.py b/tests/TestSuite_vdev_primary_secondary.py
index 7f054cda..2bfe862b 100644
--- a/tests/TestSuite_vdev_primary_secondary.py
+++ b/tests/TestSuite_vdev_primary_secondary.py
@@ -46,7 +46,7 @@  import time
 
 import framework.utils as utils
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVdevPrimarySecondary(TestCase):
diff --git a/tests/TestSuite_veb_switch.py b/tests/TestSuite_veb_switch.py
index 7b91fee3..5fd5526e 100644
--- a/tests/TestSuite_veb_switch.py
+++ b/tests/TestSuite_veb_switch.py
@@ -39,14 +39,9 @@  import re
 import time
 
 import framework.utils as utils
-from framework.dut import Dut
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.project_dpdk import DPDKdut
-from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.utils import RED
-from framework.virt_dut import VirtDut
 
 
 class TestVEBSwitching(TestCase):
diff --git a/tests/TestSuite_vf_daemon.py b/tests/TestSuite_vf_daemon.py
index 29520965..1f119adf 100644
--- a/tests/TestSuite_vf_daemon.py
+++ b/tests/TestSuite_vf_daemon.py
@@ -30,16 +30,11 @@ 
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import random
-import sys
 import time
 
-from scapy.utils import rdpcap
-
-import framework.utils as utils
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
-from framework.settings import get_nic_name
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.test_case import TestCase
 
 VM_CORES_MASK = "all"
diff --git a/tests/TestSuite_vf_interrupt_pmd.py b/tests/TestSuite_vf_interrupt_pmd.py
index d0b02b12..a4d6020f 100644
--- a/tests/TestSuite_vf_interrupt_pmd.py
+++ b/tests/TestSuite_vf_interrupt_pmd.py
@@ -35,14 +35,10 @@  DPDK Test suite.
 Test vf_interrupt_pmd.
 """
 
-import pdb
-import re
-import time
-
 import framework.utils as utils
 from framework.packet import Packet
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVfInterruptPmd(TestCase):
diff --git a/tests/TestSuite_vf_jumboframe.py b/tests/TestSuite_vf_jumboframe.py
index 2245a92e..0fb15a3f 100644
--- a/tests/TestSuite_vf_jumboframe.py
+++ b/tests/TestSuite_vf_jumboframe.py
@@ -29,16 +29,13 @@ 
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import re
 import time
 
 import framework.utils as utils
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.utils import RED
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "all"
 
diff --git a/tests/TestSuite_vf_kernel.py b/tests/TestSuite_vf_kernel.py
index b30b60b2..755f5741 100755
--- a/tests/TestSuite_vf_kernel.py
+++ b/tests/TestSuite_vf_kernel.py
@@ -44,9 +44,9 @@  import time
 import framework.utils as utils
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.test_case import TestCase
-from framework.utils import GREEN, RED
+from framework.utils import GREEN
 
 
 class TestVfKernel(TestCase):
diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilter.py
index 5351cb68..2e4d08b4 100644
--- a/tests/TestSuite_vf_macfilter.py
+++ b/tests/TestSuite_vf_macfilter.py
@@ -29,12 +29,11 @@ 
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import re
 import time
 
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "all"
 
diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index dff1a1b9..ff01e2ad 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -30,17 +30,12 @@ 
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import re
-import string
 import time
 
 import framework.utils as utils
-from framework.crb import Crb
 from framework.pmd_output import PmdOutput
-from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.utils import GREEN, RED
-from framework.virt_common import VM
-from nics.net_device import NetDevice
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "all"
 DEFAULT_MTU = 1500
diff --git a/tests/TestSuite_vf_packet_rxtx.py b/tests/TestSuite_vf_packet_rxtx.py
index ea000c83..d3597013 100644
--- a/tests/TestSuite_vf_packet_rxtx.py
+++ b/tests/TestSuite_vf_packet_rxtx.py
@@ -29,13 +29,12 @@ 
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import re
 import time
 
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "all"
 
diff --git a/tests/TestSuite_vf_port_start_stop.py b/tests/TestSuite_vf_port_start_stop.py
index 5192653d..eebf68ac 100644
--- a/tests/TestSuite_vf_port_start_stop.py
+++ b/tests/TestSuite_vf_port_start_stop.py
@@ -29,13 +29,12 @@ 
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import re
 import time
 
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "all"
 
diff --git a/tests/TestSuite_vf_rss.py b/tests/TestSuite_vf_rss.py
index b8bf65a5..150d658a 100644
--- a/tests/TestSuite_vf_rss.py
+++ b/tests/TestSuite_vf_rss.py
@@ -46,7 +46,7 @@  from framework.pmd_output import PmdOutput
 # Use scapy to send packets with different source and dest ip.
 # and collect the hash result of five tuple and the queue id.
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVfRss(TestCase):
diff --git a/tests/TestSuite_vf_to_vf_nic_bridge.py b/tests/TestSuite_vf_to_vf_nic_bridge.py
index f9b5b9ab..f46a65ad 100644
--- a/tests/TestSuite_vf_to_vf_nic_bridge.py
+++ b/tests/TestSuite_vf_to_vf_nic_bridge.py
@@ -33,14 +33,13 @@  DPDK Test suite
 Test vf to vf nic bridge
 """
 
-import pdb
 import re
 import time
 
 import framework.utils as utils
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VF_NUMS_ON_ONE_PF = 2
 VF_TEMP_MAC = "52:54:12:45:67:1%d"
diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py
index d4cf29b3..e80531e3 100644
--- a/tests/TestSuite_vf_vlan.py
+++ b/tests/TestSuite_vf_vlan.py
@@ -30,14 +30,12 @@ 
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import random
-import re
 import time
 
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.settings import get_nic_name
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 VM_CORES_MASK = "all"
 MAX_VLAN = 4095
diff --git a/tests/TestSuite_vhost_event_idx_interrupt.py b/tests/TestSuite_vhost_event_idx_interrupt.py
index f01465f1..65001305 100644
--- a/tests/TestSuite_vhost_event_idx_interrupt.py
+++ b/tests/TestSuite_vhost_event_idx_interrupt.py
@@ -37,9 +37,8 @@  Vhost event idx interrupt need test with l3fwd-power sample
 import re
 import time
 
-import framework.utils as utils
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVhostEventIdxInterrupt(TestCase):
diff --git a/tests/TestSuite_vhost_multi_queue_qemu.py b/tests/TestSuite_vhost_multi_queue_qemu.py
index 6359bfc8..f17daf70 100644
--- a/tests/TestSuite_vhost_multi_queue_qemu.py
+++ b/tests/TestSuite_vhost_multi_queue_qemu.py
@@ -43,7 +43,7 @@  from framework.pktgen import PacketGeneratorHelper
 from framework.pmd_output import PmdOutput
 from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVhostMultiQueueQemu(TestCase):
diff --git a/tests/TestSuite_vhost_pmd_xstats.py b/tests/TestSuite_vhost_pmd_xstats.py
index 9adb9708..7f6dcecf 100644
--- a/tests/TestSuite_vhost_pmd_xstats.py
+++ b/tests/TestSuite_vhost_pmd_xstats.py
@@ -37,13 +37,9 @@  vhost pmd xstats test suite.
 import copy
 import datetime
 import re
-import time
 
-import framework.utils as utils
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
-from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
 
 ETHER_JUMBO_FRAME_MTU = 9000
diff --git a/tests/TestSuite_vhost_user_live_migration.py b/tests/TestSuite_vhost_user_live_migration.py
index a5e72672..8ac41973 100644
--- a/tests/TestSuite_vhost_user_live_migration.py
+++ b/tests/TestSuite_vhost_user_live_migration.py
@@ -32,12 +32,11 @@  import os.path
 import re
 import time
 
-import framework.utils as utils
 from framework.config import UserConf
 from framework.exception import VirtDutInitException
 from framework.settings import CONFIG_ROOT_PATH
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVhostUserLiveMigration(TestCase):
diff --git a/tests/TestSuite_vhost_virtio_pmd_interrupt.py b/tests/TestSuite_vhost_virtio_pmd_interrupt.py
index e541b5e3..51ad0154 100644
--- a/tests/TestSuite_vhost_virtio_pmd_interrupt.py
+++ b/tests/TestSuite_vhost_virtio_pmd_interrupt.py
@@ -41,7 +41,7 @@  import framework.utils as utils
 from framework.packet import Packet
 from framework.pktgen import PacketGeneratorHelper
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVhostVirtioPmdInterrupt(TestCase):
diff --git a/tests/TestSuite_virtio_event_idx_interrupt.py b/tests/TestSuite_virtio_event_idx_interrupt.py
index 2429887b..2ef56fac 100644
--- a/tests/TestSuite_virtio_event_idx_interrupt.py
+++ b/tests/TestSuite_virtio_event_idx_interrupt.py
@@ -38,10 +38,9 @@  import _thread
 import re
 import time
 
-import framework.utils as utils
 from framework.pktgen import PacketGeneratorHelper
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVirtioIdxInterrupt(TestCase):
diff --git a/tests/TestSuite_virtio_ipsec_cryptodev_func.py b/tests/TestSuite_virtio_ipsec_cryptodev_func.py
index 07ec5633..00dc7558 100644
--- a/tests/TestSuite_virtio_ipsec_cryptodev_func.py
+++ b/tests/TestSuite_virtio_ipsec_cryptodev_func.py
@@ -33,14 +33,11 @@  DPDK Test suite
 Test DPDK vhost + virtio scenarios
 """
 import binascii
-import os
-import subprocess
-import time
 
 import framework.utils as utils
 import tests.cryptodev_common as cc
 from framework.packet import Packet
-from framework.qemu_kvm import QEMUKvm
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.test_case import TestCase
 
 
diff --git a/tests/TestSuite_virtio_perf_cryptodev_func.py b/tests/TestSuite_virtio_perf_cryptodev_func.py
index 2a1ae951..d89cb024 100644
--- a/tests/TestSuite_virtio_perf_cryptodev_func.py
+++ b/tests/TestSuite_virtio_perf_cryptodev_func.py
@@ -32,12 +32,9 @@ 
 DPDK Test suite
 Test DPDK vhost + virtio scenarios
 """
-import os
-import subprocess
 
-import framework.utils as utils
 import tests.cryptodev_common as cc
-from framework.qemu_kvm import QEMUKvm
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.test_case import TestCase
 
 
diff --git a/tests/TestSuite_virtio_pvp_regression.py b/tests/TestSuite_virtio_pvp_regression.py
index 9d7fe197..3ea0aef7 100644
--- a/tests/TestSuite_virtio_pvp_regression.py
+++ b/tests/TestSuite_virtio_pvp_regression.py
@@ -44,11 +44,10 @@  qemu =
 import re
 import time
 
-import framework.utils as utils
 from framework.pktgen import PacketGeneratorHelper
 from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVirtioPVPRegression(TestCase):
diff --git a/tests/TestSuite_virtio_unit_cryptodev_func.py b/tests/TestSuite_virtio_unit_cryptodev_func.py
index 22e595e4..08cd03e3 100644
--- a/tests/TestSuite_virtio_unit_cryptodev_func.py
+++ b/tests/TestSuite_virtio_unit_cryptodev_func.py
@@ -34,12 +34,8 @@  DPDK Test suite
 Test DPDK vhost + virtio scenarios
 """
 
-import os
-import subprocess
-
-import framework.utils as utils
 import tests.cryptodev_common as cc
-from framework.qemu_kvm import QEMUKvm
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.test_case import TestCase
 
 
diff --git a/tests/TestSuite_vm2vm_virtio_net_perf.py b/tests/TestSuite_vm2vm_virtio_net_perf.py
index 486f1acf..3b107368 100644
--- a/tests/TestSuite_vm2vm_virtio_net_perf.py
+++ b/tests/TestSuite_vm2vm_virtio_net_perf.py
@@ -46,7 +46,7 @@  import time
 import framework.utils as utils
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVM2VMVirtioNetPerf(TestCase):
diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py b/tests/TestSuite_vm2vm_virtio_pmd.py
index 9460c5fa..e208c87c 100644
--- a/tests/TestSuite_vm2vm_virtio_pmd.py
+++ b/tests/TestSuite_vm2vm_virtio_pmd.py
@@ -45,7 +45,7 @@  import framework.utils as utils
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVM2VMVirtioPMD(TestCase):
diff --git a/tests/TestSuite_vm_hotplug.py b/tests/TestSuite_vm_hotplug.py
index b9084e35..b96d780c 100644
--- a/tests/TestSuite_vm_hotplug.py
+++ b/tests/TestSuite_vm_hotplug.py
@@ -41,7 +41,7 @@  import re
 import time
 
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.test_case import TestCase
 
 VM_CORES_MASK = "all"
diff --git a/tests/TestSuite_vm_power_manager.py b/tests/TestSuite_vm_power_manager.py
index 917a60f3..2c6a37bc 100644
--- a/tests/TestSuite_vm_power_manager.py
+++ b/tests/TestSuite_vm_power_manager.py
@@ -37,8 +37,7 @@  VM power manager test suite.
 import re
 
 import framework.utils as utils
-from framework.qemu_libvirt import LibvirtKvm
-from framework.settings import HEADER_SIZE
+from tests.util.virt.qemu_libvirt import LibvirtKvm
 from framework.test_case import TestCase
 
 
diff --git a/tests/TestSuite_vm_pw_mgmt_policy.py b/tests/TestSuite_vm_pw_mgmt_policy.py
index d15cbbe0..0f43f289 100644
--- a/tests/TestSuite_vm_pw_mgmt_policy.py
+++ b/tests/TestSuite_vm_pw_mgmt_policy.py
@@ -36,7 +36,6 @@  virtual power manager policy (traffic/time) test suite.
 import os
 import random
 import re
-import textwrap
 import time
 import traceback
 from copy import deepcopy
@@ -48,7 +47,7 @@  from framework.exception import VerifyFailure
 from framework.packet import Packet
 from framework.pktgen import TRANSMIT_CONT
 from framework.pmd_output import PmdOutput
-from framework.qemu_libvirt import LibvirtKvm
+from tests.util.virt.qemu_libvirt import LibvirtKvm
 from framework.test_case import TestCase
 from framework.utils import create_mask as dts_create_mask
 
diff --git a/tests/TestSuite_vswitch_sample_cbdma.py b/tests/TestSuite_vswitch_sample_cbdma.py
index 503c8ba0..5fa901f7 100644
--- a/tests/TestSuite_vswitch_sample_cbdma.py
+++ b/tests/TestSuite_vswitch_sample_cbdma.py
@@ -45,7 +45,7 @@  from framework.pktgen import PacketGeneratorHelper
 from framework.pmd_output import PmdOutput
 from framework.settings import HEADER_SIZE
 from framework.test_case import TestCase
-from framework.virt_common import VM
+from tests.util.virt.virt_common import VM
 
 
 class TestVswitchSampleCBDMA(TestCase):
diff --git a/framework/qemu_kvm.py b/tests/util/virt/qemu_kvm.py
similarity index 99%
rename from framework/qemu_kvm.py
rename to tests/util/virt/qemu_kvm.py
index 5615263b..c6db1bb7 100644
--- a/framework/qemu_kvm.py
+++ b/tests/util/virt/qemu_kvm.py
@@ -34,10 +34,10 @@  import os
 import re
 import time
 
-from .exception import StartVMFailedException
-from .settings import DTS_PARALLEL_SETTING, get_host_ip, load_global_setting
-from .utils import RED, parallel_lock
-from .virt_base import ST_NOTSTART, ST_PAUSE, ST_RUNNING, ST_UNKNOWN, VirtBase
+from framework.exception import StartVMFailedException
+from framework.settings import get_host_ip
+from framework.utils import RED, parallel_lock
+from tests.util.virt.virt_base import ST_NOTSTART, ST_PAUSE, ST_RUNNING, ST_UNKNOWN, VirtBase
 
 # This name is directly defined in the qemu guest service
 # So you can not change it except it is changed by the service
diff --git a/framework/qemu_libvirt.py b/tests/util/virt/qemu_libvirt.py
similarity index 99%
rename from framework/qemu_libvirt.py
rename to tests/util/virt/qemu_libvirt.py
index 740b7bbc..63a4bce9 100644
--- a/framework/qemu_libvirt.py
+++ b/tests/util/virt/qemu_libvirt.py
@@ -36,15 +36,8 @@  import xml.etree.ElementTree as ET
 from xml.dom import minidom
 from xml.etree.ElementTree import ElementTree
 
-import framework.utils as utils
-
-from .config import VIRTCONF, VirtConf
-from .dut import Dut
-from .exception import StartVMFailedException
-from .logger import getLogger
-from .ssh_connection import SSHConnection
-from .virt_base import VirtBase
-from .virt_resource import VirtResource
+from framework.exception import StartVMFailedException
+from tests.util.virt.virt_base import VirtBase
 
 
 class LibvirtKvm(VirtBase):
diff --git a/tests/util/virt/virt_common.py b/tests/util/virt/virt_common.py
index 36ea540e..a0057ded 100644
--- a/tests/util/virt/virt_common.py
+++ b/tests/util/virt/virt_common.py
@@ -31,8 +31,8 @@ 
 import os
 
 from framework.config import VirtConf
-from framework.qemu_kvm import QEMUKvm
-from framework.qemu_libvirt import LibvirtKvm
+from tests.util.virt.qemu_kvm import QEMUKvm
+from tests.util.virt.qemu_libvirt import LibvirtKvm
 from framework.settings import CONFIG_ROOT_PATH
 
 
diff --git a/tests/util/virt/virt_scene.py b/tests/util/virt/virt_scene.py
index 694f84b9..7dc7d45e 100644
--- a/tests/util/virt/virt_scene.py
+++ b/tests/util/virt/virt_scene.py
@@ -28,14 +28,13 @@ 
 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import time
 
 import framework.utils as utils
 
-from framework.config import VIRTCONF, VirtConf
+from framework.config import VirtConf
 from framework.exception import *
 from framework.pmd_output import PmdOutput
-from framework.qemu_kvm import QEMUKvm
+from tests.util.virt.qemu_kvm import QEMUKvm
 from framework.settings import CONFIG_ROOT_PATH, get_netdev
 from framework.utils import create_mask