This commit is contained in:
Julien Duponchelle 2015-02-13 20:57:09 +01:00
parent d86e880ff7
commit a9a3bb1c38
3 changed files with 15 additions and 4 deletions

View File

@ -24,8 +24,8 @@ class EthernetAdapter(Adapter):
VPCS Ethernet adapter.
"""
def __init__(self):
Adapter.__init__(self, interfaces=1)
def __init__(self, interfaces=1):
Adapter.__init__(self, interfaces=interfaces)
def __str__(self):

View File

@ -24,8 +24,8 @@ class SerialAdapter(Adapter):
VPCS Ethernet adapter.
"""
def __init__(self):
Adapter.__init__(self, interfaces=1)
def __init__(self, interfaces=1):
Adapter.__init__(self, interfaces=interfaces)
def __str__(self):

View File

@ -163,6 +163,17 @@ def test_iou_nio_create_ethernet(server, vm):
assert response.json["ethernet_device"] == "eth0"
def test_iou_nio_create_ethernet_different_port(server, vm):
response = server.post("/projects/{project_id}/iou/vms/{vm_id}/adapters/0/ports/3/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_generic_ethernet",
"ethernet_device": "eth0",
},
example=False)
assert response.status == 201
assert response.route == "/projects/{project_id}/iou/vms/{vm_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio"
assert response.json["type"] == "nio_generic_ethernet"
assert response.json["ethernet_device"] == "eth0"
def test_iou_nio_create_tap(server, vm):
with patch("gns3server.modules.base_manager.BaseManager._has_privileged_access", return_value=True):
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_tap",