Skip to content

Commit

Permalink
use ip addr instead ip link to use the common pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
LiliDeng committed Jul 1, 2023
1 parent b0e03f3 commit 9c4b50c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lisa/tools/ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ def nic_exists(self, nic_name: str) -> bool:
)

def get_mac(self, nic_name: str) -> str:
result = self.run(f"link show {nic_name}", force_run=True, sudo=True)
result = self.run(f"addr show {nic_name}", force_run=True, sudo=True)
matched = self.__ip_addr_show_regex.match(result.stdout)
assert matched
assert matched, f"not find mac address for nic {nic_name}"
return matched.group("mac")

def get_info(self, nic_name: Optional[str] = None) -> List[IpInfo]:
Expand Down Expand Up @@ -318,7 +318,7 @@ def setup_tap(self, name: str, bridge: str) -> None:
def get_ip_address(self, nic_name: str) -> str:
result = self.run(f"addr show {nic_name}", force_run=True, sudo=True)
matched = self.__ip_addr_show_regex.match(result.stdout)
assert matched
assert matched, f"not find ip address for nic {nic_name}"
return matched.group("ip_addr")

def get_default_route_info(self) -> tuple[str, str]:
Expand Down

0 comments on commit 9c4b50c

Please sign in to comment.