working on opensecurityd
authorom
Fri, 06 Dec 2013 12:29:15 +0100
changeset 170b4efa323de3
parent 16 e16d64b5e008
child 18 d7d7b8dee78e
working on opensecurityd
OpenSecurity/bin/opensecurityd.py
server/opensecurityd.pyc
     1.1 --- a/OpenSecurity/bin/opensecurityd.py	Fri Dec 06 12:24:24 2013 +0100
     1.2 +++ b/OpenSecurity/bin/opensecurityd.py	Fri Dec 06 12:29:15 2013 +0100
     1.3 @@ -51,11 +51,11 @@
     1.4  
     1.5  """All the URLs we know mapping to class handler"""
     1.6  opensecurity_urls = (
     1.7 -    '/device_change',           'os_device_change',
     1.8 -    '/sdvms',                   'os_sdvms',
     1.9 -    '/vms',                     'os_vms',
    1.10 -    '/vms/(.*)',                'os_vm',
    1.11 -    '/',                        'os_root'
    1.12 +    '/device_change',           'os_device_change',     # http://localhost:8080/device_change   GET
    1.13 +    '/sdvms',                   'os_sdvms',             # http://localhost:8080/sdvms           GET, PUT, DELETE
    1.14 +    '/vms',                     'os_vms',               # http://localhost:8080/vms             GET
    1.15 +    '/vms/(.*)',                'os_vm',                # http://localhost:8080/vms/[VMNAME]    GET
    1.16 +    '/',                        'os_root'               # http://localhost:8080/                GET
    1.17  )
    1.18  
    1.19  
    1.20 @@ -74,8 +74,8 @@
    1.21      """OpenSecurity '/device_change' handler"""
    1.22      
    1.23      def GET(self):
    1.24 -        #gvm_mgr.configureHostNetworking()
    1.25 -        print 'received device_change'
    1.26 +        gvm_mgr.cygwin_path = 'c:\\cygwin64\\bin\\'
    1.27 +        gvm_mgr.handleDeviceChange()
    1.28          return "os_device_change"
    1.29  
    1.30  
    1.31 @@ -83,11 +83,31 @@
    1.32      """OpenSecurity '/sdvms' handler"""
    1.33      
    1.34      def GET(self):
    1.35 +        """get the list of SDVMs"""
    1.36          return gvm_mgr.listSDVM() 
    1.37              
    1.38 +    def PUT(self):
    1.39 +        """create a new SDVM"""
    1.40 +        print("os_sdvms:PUT - 1")
    1.41 +        # pick the vm-name
    1.42 +        args = web.input()
    1.43 +        if not "name" in args:
    1.44 +            raise web.badrequest()
    1.45 +        print("os_sdvms:PUT - 2")
    1.46 +            
    1.47 +        return gvm_mgr.createVM(args.name)
    1.48 +            
    1.49 +    def DELETE(self):
    1.50 +        """remove a new SDVM"""
    1.51 +        # pick the vm-name
    1.52 +        args = web.input()
    1.53 +        if not "name" in args:
    1.54 +            raise web.badrequest()
    1.55 +            
    1.56 +        return gvm_mgr.removeVM(args.name)
    1.57  
    1.58  class os_vm:
    1.59 -    """OpenSecurity '/vms/VM' handler"""
    1.60 +    """OpenSecurity '/vms/[VM]' handler"""
    1.61      
    1.62      def GET(self, name):
    1.63          return gvm_mgr.getVMInfo(name)
     2.1 Binary file server/opensecurityd.pyc has changed