mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Support IOURC update
This commit is contained in:
parent
8ca9c2121a
commit
4a9f578784
@ -117,6 +117,7 @@ class IOUHandler:
|
|||||||
vm.nvram = request.json.get("nvram", vm.nvram)
|
vm.nvram = request.json.get("nvram", vm.nvram)
|
||||||
vm.l1_keepalives = request.json.get("l1_keepalives", vm.l1_keepalives)
|
vm.l1_keepalives = request.json.get("l1_keepalives", vm.l1_keepalives)
|
||||||
vm.initial_config = request.json.get("initial_config_content", vm.initial_config)
|
vm.initial_config = request.json.get("initial_config_content", vm.initial_config)
|
||||||
|
vm.iourc_content = request.json.get("iourc_content", None)
|
||||||
|
|
||||||
response.json(vm)
|
response.json(vm)
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ class IOUVM(BaseVM):
|
|||||||
|
|
||||||
# We can't test this because it's mean distributing a valid licence key
|
# We can't test this because it's mean distributing a valid licence key
|
||||||
# in tests or generating one
|
# in tests or generating one
|
||||||
if not sys._called_from_test:
|
if not hasattr(sys, "_called_from_test"):
|
||||||
try:
|
try:
|
||||||
hostid = (yield from gns3server.utils.asyncio.subprocess_check_output("hostid")).strip()
|
hostid = (yield from gns3server.utils.asyncio.subprocess_check_output("hostid")).strip()
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
|
@ -130,6 +130,10 @@ IOU_UPDATE_SCHEMA = {
|
|||||||
"use_default_iou_values": {
|
"use_default_iou_values": {
|
||||||
"description": "Use default IOU values",
|
"description": "Use default IOU values",
|
||||||
"type": ["boolean", "null"]
|
"type": ["boolean", "null"]
|
||||||
|
},
|
||||||
|
"iourc_content": {
|
||||||
|
"description": "Content of the iourc file, if a file exist on servers this variable is ignored. It's mostly for compatibility with < 1.3 releases",
|
||||||
|
"type": ["string", "null"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
|
@ -147,7 +147,8 @@ def test_iou_update(server, vm, tmpdir, free_console_port, project):
|
|||||||
"serial_adapters": 0,
|
"serial_adapters": 0,
|
||||||
"l1_keepalives": True,
|
"l1_keepalives": True,
|
||||||
"initial_config_content": "hostname test",
|
"initial_config_content": "hostname test",
|
||||||
"use_default_iou_values": True
|
"use_default_iou_values": True,
|
||||||
|
"iourc_content": "test"
|
||||||
}
|
}
|
||||||
response = server.put("/projects/{project_id}/iou/vms/{vm_id}".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), params, example=True)
|
response = server.put("/projects/{project_id}/iou/vms/{vm_id}".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), params, example=True)
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
@ -163,6 +164,8 @@ def test_iou_update(server, vm, tmpdir, free_console_port, project):
|
|||||||
with open(initial_config_file(project, response.json)) as f:
|
with open(initial_config_file(project, response.json)) as f:
|
||||||
assert f.read() == "hostname test"
|
assert f.read() == "hostname test"
|
||||||
|
|
||||||
|
assert "iourc" in response.json["iourc_path"]
|
||||||
|
|
||||||
|
|
||||||
def test_iou_nio_create_udp(server, vm):
|
def test_iou_nio_create_udp(server, vm):
|
||||||
response = server.post("/projects/{project_id}/iou/vms/{vm_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_udp",
|
response = server.post("/projects/{project_id}/iou/vms/{vm_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_udp",
|
||||||
|
Loading…
Reference in New Issue
Block a user