Code refactor to handle controller failure.

The test function that was responsible for checking if a controller is
alive had the code to amend RFMonitor instance and stop test. Now it has
been refactored to a new function that is invoked by the test function.

Signed-off-by: Srijan Mishra <srijan23mishra@gmail.com>