Skip to content

Commit

Permalink
Merge pull request avocado-framework#3887 from Yingshun/iface_details
Browse files Browse the repository at this point in the history
Enhance get_interface_details to support virsh instance
  • Loading branch information
chloerh committed Apr 11, 2024
2 parents 01316c9 + 1bfdf6a commit 394eaeb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions virttest/utils_test/libvirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,14 +1377,16 @@ def check_exit_status(result, expect_error=False):
)


def get_interface_details(vm_name):
def get_interface_details(vm_name, virsh_instance=virsh):
"""
Get the interface details from virsh domiflist command output
:param vm_name: vm's name
:param virsh_instance: virsh instance object
:return: list of all interfaces details
"""
# Parse the domif-list command output
domiflist_out = virsh.domiflist(vm_name).stdout_text
domiflist_out = virsh_instance.domiflist(vm_name).stdout_text
# Regular expression for the below output
# vnet0 bridge virbr0 virtio 52:54:00:b2:b3:b4
rg = re.compile(r"^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+" "(([a-fA-F0-9]{2}:?){6})")
Expand Down

0 comments on commit 394eaeb

Please sign in to comment.