Skip to content

Commit

Permalink
qemu_guest_agent: Add new api support 'guest-network-get-route'
Browse files Browse the repository at this point in the history
Add new api 'guest-network-get-route' to support qga query route
info of Guest.

Signed-off-by: Dehan Meng <[email protected]>
  • Loading branch information
6-dehan committed Sep 11, 2024
1 parent af63fc5 commit 94a958d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qemu/tests/cfg/qemu_guest_agent.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@
image_snapshot = no
cmd_disable_network = wmic path win32_networkadapter where "NetConnectionID='%s'" call disable
cmd_enable_network = wmic path win32_networkadapter where "NetConnectionID='%s'" call enable
- check_get_network_route:
only Linux
gagent_check_type = get_network_route
- check_fsfreeze:
gagent_fs_test_cmd = "echo foo > %s/foo"
delete_temp_file = "rm -rf ${mountpoint_def}/foo"
Expand Down
30 changes: 30 additions & 0 deletions qemu/tests/qemu_guest_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,36 @@ def ip_addr_check(session, mac_addr, ret_list, if_index, if_name):
if session_serial:
session_serial.close()

@error_context.context_aware
def gagent_check_get_network_route(self, test, params, env):
"""
Execute "guest-network-get-route" command to guest agent
Steps:
1) login guest with serial session
2) get the available interface name via mac address
3) check the available interface name is the same with guest
4) check ip address is the same with guest
5) create a bridge interface for linux guest and check it
from guest agent;
disable interface for windows guest and check it
from guest agent
6) check "guest-network-get-interfaces" result
7) recover the interfaces
8) change ip address
9) check "guest-network-get-interfaces" result
:param test: kvm test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
session = self._get_session(params, self.vm)
self._open_session_list.append(session)

error_context.context("Check network route info of guest.", LOG_JOB.info)
route_info_qga = self.gagent.get_network_interface()
print("type of route info: {}; route info: {}".format(type(route_info_qga), route_info_qga))

@error_context.context_aware
def gagent_check_reboot_shutdown(self, test, params, env):
"""
Expand Down

0 comments on commit 94a958d

Please sign in to comment.