'Helper to check expected rpc call are received
:param call: The call to check
:param expected_devices: The device for which call is expected
:param is_up: True if expected_devices are devices that are set up,
False if expected_devices are devices that are set down'

def _expected_plugin_rpc_call(self, call, expected_devices, is_up=True):

    if is_up:
        rpc_devices = [dev for args in call.call_args_list for dev in args[0][1]]
    else:
        rpc_devices = [dev for args in call.call_args_list for dev in args[0][2]]
    for dev in rpc_devices:
        if (dev in expected_devices):
            expected_devices.remove(dev)
    call.reset_mock()
    return (not expected_devices)
