google / testrun

A tool to automate verification of network-based device behavior
Apache License 2.0
23 stars 9 forks source link

Detect device disconnected #602

Closed hitnik closed 3 weeks ago

hitnik commented 1 month ago

Detection of device disconnection. The connection monitoring thread runs in the background and checks the connection once per second.

jboddey commented 1 month ago

I'm currently reviewing this PR

jboddey commented 1 month ago

@hitnik this breaks the DHCP network modules because the util class is copied into those modules. Docker and psutil libraries are required so the network modules do not start. Could we take out content that requires those modules and place in a separate docker_util class?

hitnik commented 1 month ago

@hitnik this breaks the DHCP network modules because the util class is copied into those modules. Docker and psutil libraries are required so the network modules do not start. Could we take out content that requires those modules and place in a separate docker_util class?

@jboddey I noticed this behavior but didn't know the reason. I will move the function get_sys_interfaces to ip_control module.

jboddey commented 1 month ago

Error with the latest commit:

Traceback (most recent call last): File "framework/python/src/core/test_runner.py", line 100, in runner = TestRunner(config_file=args.config_file, File "framework/python/src/core/test_runner.py", line 42, in init self.test_run = Testrun(config_file=config_file, File "/home/runner/work/testrun/testrun/framework/python/src/core/testrun.py", line 126, in init self.start() File "/home/runner/work/testrun/testrun/framework/python/src/core/testrun.py", line 332, in start self.get_session().start() File "/home/runner/work/testrun/testrun/framework/python/src/common/session.py", line 114, in start self.reset() File "/home/runner/work/testrun/testrun/framework/python/src/common/session.py", line 591, in reset self._ifaces = util.get_sys_interfaces() AttributeError: module 'common.util' has no attribute 'get_sys_interfaces'

hitnik commented 1 month ago

Error with the latest commit:

Traceback (most recent call last): File "framework/python/src/core/test_runner.py", line 100, in runner = TestRunner(config_file=args.config_file, File "framework/python/src/core/test_runner.py", line 42, in init self.test_run = Testrun(config_file=config_file, File "/home/runner/work/testrun/testrun/framework/python/src/core/testrun.py", line 126, in init self.start() File "/home/runner/work/testrun/testrun/framework/python/src/core/testrun.py", line 332, in start self.get_session().start() File "/home/runner/work/testrun/testrun/framework/python/src/common/session.py", line 114, in start self.reset() File "/home/runner/work/testrun/testrun/framework/python/src/common/session.py", line 591, in reset self._ifaces = util.get_sys_interfaces() AttributeError: module 'common.util' has no attribute 'get_sys_interfaces'

fixed

jhughesbiot commented 1 month ago

I am currently working on a way to automate the dhcp disconnect tests which requires the device to be disconnected which will conflict with this feature. We will need need a way to pause the monitor thread during specific tests for both features to work.

jboddey commented 1 month ago

@hitnik The util class still references the docker module which breaks the DHCP servers. Can the get_docker_host_by_name method be moved to a new docker_utils class?

hitnik commented 1 month ago

@hitnik The util class still references the docker module which breaks the DHCP servers. Can the get_docker_host_by_name method be moved to a new docker_utils class?

I've removed this method.

jboddey commented 1 month ago

There's a few overlaps with PR #616. Will wait until that one is merged to make this PR easier to review.

jboddey commented 1 month ago

Need to get pylint working and I believe you have the incorrect email for a commit somewhere causing a CLA error.

jboddey commented 3 weeks ago

@hitnik Are you still wanting to merge this branch or has the functionality been implemented elsewhere?