1.1 --- a/OpenSecurity/bin/opensecurityd.py Fri Dec 06 12:47:53 2013 +0100
1.2 +++ b/OpenSecurity/bin/opensecurityd.py Fri Dec 06 14:24:42 2013 +0100
1.3 @@ -37,7 +37,8 @@
1.4 import subprocess
1.5 import sys
1.6 import web
1.7 -from vmmanager.vmmanager import VMManager
1.8 +
1.9 +from vmmanager import VMManager
1.10
1.11 # local
1.12 from environment import Environment
1.13 @@ -52,7 +53,8 @@
1.14 """All the URLs we know mapping to class handler"""
1.15 opensecurity_urls = (
1.16 '/device_change', 'os_device_change', # http://localhost:8080/device_change GET
1.17 - '/sdvms', 'os_sdvms', # http://localhost:8080/sdvms GET, PUT, DELETE
1.18 + '/sdvms', 'os_sdvms', # http://localhost:8080/sdvms GET, PUT
1.19 + '/sdvms/(.*)', 'os_sdvm', # http://localhost:8080/sdvms GET, DELETE
1.20 '/vms', 'os_vms', # http://localhost:8080/vms GET
1.21 '/vms/(.*)', 'os_vm', # http://localhost:8080/vms/[VMNAME] GET
1.22 '/', 'os_root' # http://localhost:8080/ GET
1.23 @@ -78,6 +80,17 @@
1.24 return "os_device_change"
1.25
1.26
1.27 +class os_sdvm:
1.28 + """OpenSecurity '/sdvms/[VM]' handler"""
1.29 +
1.30 + def GET(self, name):
1.31 + return gvm_mgr.getVMInfo(name)
1.32 +
1.33 +
1.34 + def DELETE(self, name):
1.35 + return gvm_mgr.removeVM(name)
1.36 +
1.37 +
1.38 class os_sdvms:
1.39 """OpenSecurity '/sdvms' handler"""
1.40
1.41 @@ -87,24 +100,14 @@
1.42
1.43 def PUT(self):
1.44 """create a new SDVM"""
1.45 - print("os_sdvms:PUT - 1")
1.46 - # pick the vm-name
1.47 - args = web.input()
1.48 - if not "name" in args:
1.49 - raise web.badrequest()
1.50 - print("os_sdvms:PUT - 2")
1.51 -
1.52 - return gvm_mgr.createVM(args.name)
1.53 -
1.54 - def DELETE(self):
1.55 - """remove a new SDVM"""
1.56 +
1.57 # pick the vm-name
1.58 args = web.input()
1.59 if not "name" in args:
1.60 raise web.badrequest()
1.61
1.62 - return gvm_mgr.removeVM(args.name)
1.63 -
1.64 + return gvm_mgr.createVM(args.name)
1.65 +
1.66 class os_vm:
1.67 """OpenSecurity '/vms/[VM]' handler"""
1.68