mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Remove NIO from VPCS
This commit is contained in:
1 parent
8e307c8cbb
commit
77db08c39e
5 files changed
+51
-3
No files matched your search
@@ -79,21 +79,40 @@ class VPCSHandler(object):
|
||||
@Route.post(
|
||||
r"/vpcs/{vpcs_id}/ports/{port_id}/nio",
|
||||
parameters={
|
||||
"vpcs_id": "Id of VPCS instance"
|
||||
"vpcs_id": "Id of VPCS instance",
|
||||
"port_id": "Id of the port where the nio should be add"
|
||||
},
|
||||
status_codes={
|
||||
201: "Success of creation of NIO",
|
||||
200: "Success of creation of NIO",
|
||||
404: "If VPCS doesn't exist"
|
||||
},
|
||||
description="ADD NIO to a VPCS",
|
||||
input=VPCS_NIO_SCHEMA,
|
||||
output=VPCS_NIO_SCHEMA)
|
||||
def create_nio(request, response):
|
||||
# TODO: response with nio
|
||||
vpcs_manager = VPCS.instance()
|
||||
vm = vpcs_manager.get_vm(int(request.match_info['vpcs_id']))
|
||||
nio = vm.port_add_nio_binding(int(request.match_info['port_id']), request.json)
|
||||
|
||||
response.json(nio)
|
||||
|
||||
@classmethod
|
||||
@Route.delete(
|
||||
r"/vpcs/{vpcs_id}/ports/{port_id}/nio",
|
||||
parameters={
|
||||
"vpcs_id": "Id of VPCS instance",
|
||||
"port_id": "Id of the port where the nio should be remove"
|
||||
},
|
||||
status_codes={
|
||||
200: "Success of deletin of NIO",
|
||||
404: "If VPCS doesn't exist"
|
||||
},
|
||||
description="Remove NIO from a VPCS")
|
||||
def delete_nio(request, response):
|
||||
vpcs_manager = VPCS.instance()
|
||||
vm = vpcs_manager.get_vm(int(request.match_info['vpcs_id']))
|
||||
nio = vm.port_remove_nio_binding(int(request.match_info['port_id']))
|
||||
response.json({})
|
||||
|
||||
|
||||
|
||||
@@ -70,6 +70,10 @@ class Route(object):
|
||||
def put(cls, path, *args, **kw):
|
||||
return cls._route('PUT', path, *args, **kw)
|
||||
|
||||
@classmethod
|
||||
def delete(cls, path, *args, **kw):
|
||||
return cls._route('DELETE', path, *args, **kw)
|
||||
|
||||
@classmethod
|
||||
def _route(cls, method, path, *args, **kw):
|
||||
# This block is executed only the first time
|
||||
|
||||
Reference in new issue
Block a user