Skip to content

Commit

Permalink
Merge pull request #4058 from chloerh/default-gw-iface
Browse files Browse the repository at this point in the history
get_default_gateway_json:support returning iface name of default gateway
  • Loading branch information
chloerh authored Feb 7, 2025
2 parents 731ecab + cf83413 commit 77f030f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion virttest/utils_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -4111,10 +4111,16 @@ def get_default_gateway_json(
raise exceptions.TestError("Cannot get default gateway with given condition")
elif len(default_route_list) == 1:
default_route = default_route_list[0]
if iface_name and "dev" in default_route:
return default_route["dev"]
if "gateway" in default_route:
return default_route["gateway"]
else:
gw = [path["gateway"] for path in default_route_list]
# TODO:deal with multiple gateway
if iface_name:
gw = [path["dev"] for path in default_route_list]
else:
gw = [path["gateway"] for path in default_route_list]
return gw


Expand Down

0 comments on commit 77f030f

Please sign in to comment.