diff mbox series

[v2,2/2] update files depending on tests/util

Message ID 20220411175549.14680-2-ohilyard@iol.unh.edu (mailing list archive)
State New
Headers show
Series [v2,1/2] framework: Move test-specific files to test directory | expand

Checks

Context Check Description
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-format-test fail Testing issues

Commit Message

Owen Hilyard April 11, 2022, 5:55 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/qemu_kvm.py                         |  4 +--
 framework/qemu_libvirt.py                     |  9 +------
 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 |  4 ---
 tests/TestSuite_kernelpf_iavf.py              |  4 +--
 tests/TestSuite_mdd.py                        |  4 +--
 tests/TestSuite_pipeline.py                   | 24 +++---------------
 tests/TestSuite_port_control.py               |  4 +--
 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 +---
 ...estSuite_runtime_vf_queue_number_kernel.py |  2 +-
 tests/TestSuite_sriov_kvm.py                  |  6 +----
 tests/TestSuite_vdev_primary_secondary.py     |  2 +-
 tests/TestSuite_veb_switch.py                 |  5 ----
 tests/TestSuite_vf_interrupt_pmd.py           |  6 +----
 tests/TestSuite_vf_jumboframe.py              |  5 +---
 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_user_live_migration.py  |  3 +--
 tests/TestSuite_vhost_virtio_pmd_interrupt.py |  2 +-
 tests/TestSuite_virtio_event_idx_interrupt.py |  3 +--
 tests/TestSuite_virtio_pvp_regression.py      |  3 +--
 tests/TestSuite_vm2vm_virtio_net_perf.py      |  2 +-
 tests/TestSuite_vm2vm_virtio_pmd.py           |  2 +-
 tests/TestSuite_vswitch_sample_cbdma.py       |  2 +-
 42 files changed, 49 insertions(+), 172 deletions(-)

Comments

Owen Hilyard April 11, 2022, 5:57 p.m. UTC | #1
Sorry about that, it looks like I missed the second commit when I sent it
out the first time.
Juraj Linkeš April 13, 2022, 7:28 a.m. UTC | #2
> diff --git a/framework/dut.py b/framework/dut.py index a2a93734..d6b8d34a
> 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
> 

A minor point, this is an unneccesary change that violates the current convention. Is this a result of automated tools?
Owen Hilyard April 13, 2022, 12:50 p.m. UTC | #3
Yes, that is a result of the automatic refactoring by Pycharm. I'll clean
that up when I resubmit.

On Wed, Apr 13, 2022 at 3:28 AM Juraj Linkeš <juraj.linkes@pantheon.tech>
wrote:

> > diff --git a/framework/dut.py b/framework/dut.py index a2a93734..d6b8d34a
> > 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
> >
>
> A minor point, this is an unneccesary change that violates the current
> convention. Is this a result of automated tools?
>
>
diff mbox series

Patch

diff --git a/framework/dut.py b/framework/dut.py
index a2a93734..d6b8d34a 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/qemu_kvm.py b/framework/qemu_kvm.py
index 5615263b..8d5f2924 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -35,9 +35,9 @@  import re
 import time
 
 from .exception import StartVMFailedException
-from .settings import DTS_PARALLEL_SETTING, get_host_ip, load_global_setting
+from .settings import get_host_ip
 from .utils import RED, parallel_lock
-from .virt_base import ST_NOTSTART, ST_PAUSE, ST_RUNNING, ST_UNKNOWN, VirtBase
+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/framework/qemu_libvirt.py
index 740b7bbc..88d7dce9 100644
--- a/framework/qemu_libvirt.py
+++ b/framework/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 tests.util.virt.virt_base import VirtBase
 
 
 class LibvirtKvm(VirtBase):
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..4bab553e 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
 
 # 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_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_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_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_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_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_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_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_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_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):