Skip to content

Commit

Permalink
network: add tcp and IO timeout to if_down function (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
cynepco3hahue authored and lukas-bednar committed Jun 5, 2017
1 parent afb95f9 commit 10ce16e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rrmngmnt/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,18 +625,24 @@ def if_up(self, nic):
rc, _, _ = self.host.run_command(shlex.split(cmd))
return not bool(rc)

def if_down(self, nic):
def if_down(self, nic, tcp_timeout=20, io_timeout=20):
"""
Set nic down
Args:
nic (str): Nic name
tcp_timeout (float): TCP timeout
io_timeout (float): Timeout for data operation (read/write)
Returns:
bool: True if setting nic down succeeded, false otherwise
"""
cmd = "ip link set down %s" % nic
rc, _, _ = self.host.run_command(shlex.split(cmd))
rc, _, _ = self.host.run_command(
command=shlex.split(cmd),
tcp_timeout=tcp_timeout,
io_timeout=io_timeout
)
return not bool(rc)

def is_connective(self, ping_timeout=20.0):
Expand Down

0 comments on commit 10ce16e

Please sign in to comment.