shift event preparation to setup section
@@ -17,17 +17,16 @@ def test_network_outage():
net_up = unix2.get_cmd(cmd_name="ifconfig", cmd_params={"options": "lo up"})
sudo_ensure_net_up = unix2.get_cmd(cmd_name="sudo", cmd_params={"password": "moler", "cmd_object": net_up})
sudo_ensure_net_up()
+ # run event observing "network down"
+ no_ping = unix1.get_event(event_name="ping_no_response")
+ no_ping.add_event_occurred_callback(callback=outage_callback, callback_params={})
+ no_ping.start()
# run test
ping = unix1.get_cmd(cmd_name="ping", cmd_params={"destination": "localhost", "options": "-O"})
ping.start(timeout=120)
time.sleep(3)
- # run event observing "network down"
- no_ping = unix1.get_event(event_name="ping_no_response")
- no_ping.add_event_occurred_callback(callback=outage_callback, callback_params={})
- no_ping.start()
-
ifconfig_down = unix2.get_cmd(cmd_name="ifconfig", cmd_params={"options": "lo down"})
sudo_ifconfig_down = unix2.get_cmd(cmd_name="sudo", cmd_params={"password": "moler", "cmd_object": ifconfig_down})
sudo_ifconfig_down()
