# HG changeset patch # User om # Date 1386329355 -3600 # Node ID 0b4efa323de33d5dad46156cbe22c7b8ffe62c3c # Parent e16d64b5e0087cd9104bb5131c860aaa9d33a83b working on opensecurityd diff -r e16d64b5e008 -r 0b4efa323de3 OpenSecurity/bin/opensecurityd.py --- a/OpenSecurity/bin/opensecurityd.py Fri Dec 06 12:24:24 2013 +0100 +++ b/OpenSecurity/bin/opensecurityd.py Fri Dec 06 12:29:15 2013 +0100 @@ -51,11 +51,11 @@ """All the URLs we know mapping to class handler""" opensecurity_urls = ( - '/device_change', 'os_device_change', - '/sdvms', 'os_sdvms', - '/vms', 'os_vms', - '/vms/(.*)', 'os_vm', - '/', 'os_root' + '/device_change', 'os_device_change', # http://localhost:8080/device_change GET + '/sdvms', 'os_sdvms', # http://localhost:8080/sdvms GET, PUT, DELETE + '/vms', 'os_vms', # http://localhost:8080/vms GET + '/vms/(.*)', 'os_vm', # http://localhost:8080/vms/[VMNAME] GET + '/', 'os_root' # http://localhost:8080/ GET ) @@ -74,8 +74,8 @@ """OpenSecurity '/device_change' handler""" def GET(self): - #gvm_mgr.configureHostNetworking() - print 'received device_change' + gvm_mgr.cygwin_path = 'c:\\cygwin64\\bin\\' + gvm_mgr.handleDeviceChange() return "os_device_change" @@ -83,11 +83,31 @@ """OpenSecurity '/sdvms' handler""" def GET(self): + """get the list of SDVMs""" return gvm_mgr.listSDVM() + def PUT(self): + """create a new SDVM""" + print("os_sdvms:PUT - 1") + # pick the vm-name + args = web.input() + if not "name" in args: + raise web.badrequest() + print("os_sdvms:PUT - 2") + + return gvm_mgr.createVM(args.name) + + def DELETE(self): + """remove a new SDVM""" + # pick the vm-name + args = web.input() + if not "name" in args: + raise web.badrequest() + + return gvm_mgr.removeVM(args.name) class os_vm: - """OpenSecurity '/vms/VM' handler""" + """OpenSecurity '/vms/[VM]' handler""" def GET(self, name): return gvm_mgr.getVMInfo(name) diff -r e16d64b5e008 -r 0b4efa323de3 server/opensecurityd.pyc Binary file server/opensecurityd.pyc has changed