1# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import dbus
6import json
7import logging
8
9from autotest_lib.client.bin import test
10from autotest_lib.client.common_lib import error
11
12class platform_DebugDaemonGetNetworkStatus(test.test):
13    version = 1
14
15    def run_once(self, *args, **kwargs):
16        bus = dbus.SystemBus()
17        proxy = bus.get_object('org.chromium.debugd', '/org/chromium/debugd')
18        self.iface = dbus.Interface(proxy,
19                                    dbus_interface='org.chromium.debugd')
20        result = self.iface.GetNetworkStatus()
21        logging.info('Result: %s' % result)
22        networks = json.loads(result)
23        if 'services' not in networks or 'devices' not in networks:
24            raise error.TestFail('No networks found: %s' % result)
25