2 # -*- coding: utf-8 -*-
4 # ------------------------------------------------------------
7 # the opensecurityd as RESTful server
9 # Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
11 # Copyright (C) 2013 AIT Austrian Institute of Technology
12 # AIT Austrian Institute of Technology GmbH
13 # Donau-City-Strasse 1 | 1220 Vienna | Austria
14 # http://www.ait.ac.at
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License
18 # as published by the Free Software Foundation version 2.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 # Boston, MA 02110-1301, USA.
29 # ------------------------------------------------------------
32 # ------------------------------------------------------------
40 from vmmanager.vmmanager import VMManager
43 from environment import Environment
46 # ------------------------------------------------------------
52 """All the URLs we know mapping to class handler"""
54 '/device_change', 'os_device_change',
62 # ------------------------------------------------------------
65 # Global VMManager instance
69 # ------------------------------------------------------------
73 class os_device_change:
74 """OpenSecurity '/device_change' handler"""
77 #gvm_mgr.configureHostNetworking()
78 print 'received device_change'
79 return "os_device_change"
83 """OpenSecurity '/sdvms' handler"""
86 return gvm_mgr.listSDVM()
90 """OpenSecurity '/vms/VM' handler"""
93 return gvm_mgr.getVMInfo(name)
97 """OpenSecurity '/vms' handler"""
100 return gvm_mgr.listVM()
104 """OpenSecurity '/' handler"""
107 res = "'os_server': { "
108 res += "'version': '" + __version__ + "', "
109 res += "'virtualbox_path': '" + gvm_mgr.vBoxPath + "', "
110 res += "'machine_folder': '" + gvm_mgr.getDefaultMachineFolder() + "' "
116 if __name__ == "__main__":
117 server = web.application(opensecurity_urls, globals())