mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-17 17:24:51 +02:00
31 lines
839 B
Python
31 lines
839 B
Python
|
from gns3server.modules.dynamips import HypervisorManager
|
||
|
import pytest
|
||
|
import os
|
||
|
|
||
|
|
||
|
@pytest.fixture(scope="module")
|
||
|
def hypervisor(request):
|
||
|
|
||
|
cwd = os.path.dirname(os.path.abspath(__file__))
|
||
|
dynamips_path = os.path.join(cwd, "dynamips.stable")
|
||
|
print("\nStarting Dynamips Hypervisor: {}".format(dynamips_path))
|
||
|
manager = HypervisorManager(dynamips_path, "/tmp", base_port=9000)
|
||
|
hypervisor = manager.start_new_hypervisor()
|
||
|
|
||
|
def stop():
|
||
|
print("\nStopping Dynamips Hypervisor")
|
||
|
manager.stop_all_hypervisors()
|
||
|
|
||
|
request.addfinalizer(stop)
|
||
|
return hypervisor
|
||
|
|
||
|
|
||
|
@pytest.fixture(scope="session")
|
||
|
def image(request):
|
||
|
|
||
|
cwd = os.path.dirname(os.path.abspath(__file__))
|
||
|
image_path = os.path.join(cwd, "c3725.image")
|
||
|
if not os.path.exists(image_path):
|
||
|
return None
|
||
|
return image_path
|