-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdevicemanager.py
More file actions
56 lines (47 loc) · 1.95 KB
/
devicemanager.py
File metadata and controls
56 lines (47 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of REDHAWK rest-python.
#
# REDHAWK rest-python is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# REDHAWK rest-python is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
"""
Rest handlers for Device Managers
Classes:
DeviceManagers -- Get info of all or a specific device manager
"""
from tornado import gen
from handler import JsonHandler
from helper import PropertyHelper, PortHelper
class DeviceManagers(JsonHandler, PropertyHelper, PortHelper):
@gen.coroutine
def get(self, domain_name, dev_mgr_id=None):
if dev_mgr_id:
dev_mgr = yield self.redhawk.get_device_manager(domain_name, dev_mgr_id)
services = yield self.redhawk.get_service_list(domain_name, dev_mgr_id)
devices = yield self.redhawk.get_device_list(domain_name, dev_mgr_id)
# TODO: Find out why _properties is not in device manager
prop_dict = self.format_properties(dev_mgr.query([]))
info = {
'name': dev_mgr.name,
'id': dev_mgr.id,
'properties': prop_dict,
'devices': devices,
'services': services
}
else:
managers = yield self.redhawk.get_device_manager_list(domain_name)
info = {'deviceManagers': managers}
self._render_json(info)