|
|
|
@ -80,10 +80,10 @@ def test_load(controller, controller_config_path, async_run):
|
|
|
|
|
assert controller.gns3vm.settings["vmname"] == "Test VM"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_import_computes(controller, controller_config_path, async_run):
|
|
|
|
|
def test_import_computes_1_x(controller, controller_config_path, async_run):
|
|
|
|
|
"""
|
|
|
|
|
At first start the server should import the
|
|
|
|
|
computes from the gns3_gui
|
|
|
|
|
computes from the gns3_gui 1.X
|
|
|
|
|
"""
|
|
|
|
|
gns3_gui_conf = {
|
|
|
|
|
"Servers": {
|
|
|
|
@ -115,6 +115,96 @@ def test_import_computes(controller, controller_config_path, async_run):
|
|
|
|
|
assert compute.password is None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_import_gns3vm_1_x(controller, controller_config_path, async_run):
|
|
|
|
|
"""
|
|
|
|
|
At first start the server should import the
|
|
|
|
|
gns3vm settings from the gns3_gui 1.X
|
|
|
|
|
"""
|
|
|
|
|
gns3_gui_conf = {
|
|
|
|
|
"Servers": {
|
|
|
|
|
"vm": {
|
|
|
|
|
"adjust_local_server_ip": True,
|
|
|
|
|
"auto_start": True,
|
|
|
|
|
"auto_stop": False,
|
|
|
|
|
"headless": True,
|
|
|
|
|
"remote_vm_host": "",
|
|
|
|
|
"remote_vm_password": "",
|
|
|
|
|
"remote_vm_port": 3080,
|
|
|
|
|
"remote_vm_protocol": "http",
|
|
|
|
|
"remote_vm_url": "",
|
|
|
|
|
"remote_vm_user": "",
|
|
|
|
|
"virtualization": "VMware",
|
|
|
|
|
"vmname": "GNS3 VM",
|
|
|
|
|
"vmx_path": "/Users/joe/Documents/Virtual Machines.localized/GNS3 VM.vmwarevm/GNS3 VM.vmx"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
config_dir = os.path.dirname(controller_config_path)
|
|
|
|
|
os.makedirs(config_dir, exist_ok=True)
|
|
|
|
|
with open(os.path.join(config_dir, "gns3_gui.conf"), "w+") as f:
|
|
|
|
|
json.dump(gns3_gui_conf, f)
|
|
|
|
|
|
|
|
|
|
controller.gns3vm.settings["engine"] = None
|
|
|
|
|
async_run(controller.load())
|
|
|
|
|
assert controller.gns3vm.settings["engine"] == "vmware"
|
|
|
|
|
assert controller.gns3vm.settings["enable"]
|
|
|
|
|
assert controller.gns3vm.settings["headless"]
|
|
|
|
|
assert controller.gns3vm.settings["auto_stop"] is False
|
|
|
|
|
assert controller.gns3vm.settings["vmname"] == "GNS3 VM"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_import_remote_gns3vm_1_x(controller, controller_config_path, async_run):
|
|
|
|
|
"""
|
|
|
|
|
At first start the server should import the
|
|
|
|
|
computes and remote GNS3 VM from the gns3_gui 1.X
|
|
|
|
|
"""
|
|
|
|
|
gns3_gui_conf = {
|
|
|
|
|
"Servers": {
|
|
|
|
|
"remote_servers": [
|
|
|
|
|
{
|
|
|
|
|
"host": "127.0.0.1",
|
|
|
|
|
"password": "",
|
|
|
|
|
"port": 3080,
|
|
|
|
|
"protocol": "http",
|
|
|
|
|
"url": "http://127.0.0.1:3080",
|
|
|
|
|
"user": ""
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"host": "127.0.0.1",
|
|
|
|
|
"password": "",
|
|
|
|
|
"port": 3081,
|
|
|
|
|
"protocol": "http",
|
|
|
|
|
"url": "http://127.0.0.1:3081",
|
|
|
|
|
"user": ""
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"vm": {
|
|
|
|
|
"adjust_local_server_ip": True,
|
|
|
|
|
"auto_start": True,
|
|
|
|
|
"auto_stop": False,
|
|
|
|
|
"headless": True,
|
|
|
|
|
"remote_vm_host": "127.0.0.1",
|
|
|
|
|
"remote_vm_password": "",
|
|
|
|
|
"remote_vm_port": 3081,
|
|
|
|
|
"remote_vm_protocol": "http",
|
|
|
|
|
"remote_vm_url": "http://127.0.0.1:3081",
|
|
|
|
|
"remote_vm_user": "",
|
|
|
|
|
"virtualization": "remote",
|
|
|
|
|
"vmname": "GNS3 VM",
|
|
|
|
|
"vmx_path": "/Users/joe/Documents/Virtual Machines.localized/GNS3 VM.vmwarevm/GNS3 VM.vmx"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
config_dir = os.path.dirname(controller_config_path)
|
|
|
|
|
os.makedirs(config_dir, exist_ok=True)
|
|
|
|
|
with open(os.path.join(config_dir, "gns3_gui.conf"), "w+") as f:
|
|
|
|
|
json.dump(gns3_gui_conf, f)
|
|
|
|
|
|
|
|
|
|
async_run(controller.load())
|
|
|
|
|
assert controller.gns3vm.settings["engine"] == "remote"
|
|
|
|
|
assert controller.gns3vm.settings["vmname"] == "http://127.0.0.1:3081"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_settings(controller):
|
|
|
|
|
controller._notification = MagicMock()
|
|
|
|
|
controller.settings = {"a": 1}
|
|
|
|
|