Skip to content

Commit

Permalink
use is_interface_link_up from configure_network utility
Browse files Browse the repository at this point in the history
to check if the neterface link is up or not before starting the
tests.

Used instead of sleep and this function waits for max 120s

Signed-off-by: Vaishnavi Bhat <[email protected]>
  • Loading branch information
vaishnavibhat committed Jan 23, 2020
1 parent a5718c7 commit dd5a273
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions io/net/network_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from avocado.utils import genio
from avocado.utils.configure_network import PeerInfo
from avocado.utils import configure_network
from avocado.utils import wait


class NetworkTest(Test):
Expand Down Expand Up @@ -62,6 +63,9 @@ def setUp(self):
self.ipaddr = self.params.get("host_ip", default="")
self.netmask = self.params.get("netmask", default="")
configure_network.set_ip(self.ipaddr, self.netmask, self.iface)
if not wait.wait_for(configure_network.is_interface_link_up,
timeout=120, args=[self.iface]):
self.fail("Link up of interface is taking longer than 120 seconds")
self.peer = self.params.get("peer_ip")
if not self.peer:
self.cancel("No peer provided")
Expand All @@ -74,6 +78,9 @@ def setUp(self):
self.peer_interface = self.peerinfo.get_peer_interface(self.peer)
self.mtu = self.params.get("mtu", default=1500)
self.mtu_set()
if not wait.wait_for(configure_network.is_interface_link_up,
timeout=120, args=[self.iface]):
self.fail("Link up of interface is taking longer than 120 seconds")
if not configure_network.ping_check(self.iface, self.peer, "5"):
self.cancel("No connection to peer")

Expand Down

0 comments on commit dd5a273

Please sign in to comment.