Merge branch '2.1' into filters_iou

This commit is contained in:
Julien Duponchelle committed 2017-07-17 17:51:17 +02:00
commit 08d4c1a000
15 files changed
+266 -11

No files matched your search

+3 -1
View File
@@ -26,7 +26,7 @@ from tests.utils import asyncio_patch
@pytest.fixture
def nio():
return NIOUDP(4242, "127.0.0.1", 4343, [])
return NIOUDP(4242, "127.0.0.1", 4343, {})
@pytest.fixture
@@ -159,6 +159,7 @@ def test_linux_ethernet_raw_add_nio(linux_platform, project, async_run, nio):
ubridge_mock.assert_has_calls([
call("bridge create {}-0".format(cloud._id)),
call("bridge add_nio_udp {}-0 4242 127.0.0.1 4343".format(cloud._id)),
call('bridge reset_packet_filters {}-0'.format(cloud._id)),
call("bridge add_nio_linux_raw {}-0 \"eth0\"".format(cloud._id)),
call("bridge start {}-0".format(cloud._id)),
])
@@ -188,6 +189,7 @@ def test_linux_ethernet_raw_add_nio_bridge(linux_platform, project, async_run, n
ubridge_mock.assert_has_calls([
call("bridge create {}-0".format(cloud._id)),
call("bridge add_nio_udp {}-0 4242 127.0.0.1 4343".format(cloud._id)),
call('bridge reset_packet_filters {}-0'.format(cloud._id)),
call("bridge add_nio_tap \"{}-0\" \"{}\"".format(cloud._id, tap)),
call("brctl addif \"bridge0\" \"{}\"".format(tap)),
call("bridge start {}-0".format(cloud._id)),
@@ -24,9 +24,9 @@ def test_arp_command(async_run):
node = AsyncioMagicMock()
node.name = "Test"
node.nios = {}
node.nios[0] = NIOUDP(55, "127.0.0.1", 56, [])
node.nios[0] = NIOUDP(55, "127.0.0.1", 56, {})
node.nios[0].name = "Ethernet0"
node.nios[1] = NIOUDP(55, "127.0.0.1", 56, [])
node.nios[1] = NIOUDP(55, "127.0.0.1", 56, {})
node.nios[1].name = "Ethernet1"
node._hypervisor.send = AsyncioMagicMock(return_value=["0050.7966.6801 1 Ethernet0", "0050.7966.6802 1 Ethernet1"])
console = EthernetSwitchConsole(node)
+4 -5
View File
@@ -125,12 +125,11 @@ def test_change_aux_port(node, port_manager):
def test_update_ubridge_udp_connection(node, async_run):
filters = [{
"type": "latency",
"value": 10
}]
filters = {
"latency": [10]
}
snio = NIOUDP(1245, "localhost", 1246, [])
snio = NIOUDP(1245, "localhost", 1246, {})
dnio = NIOUDP(1245, "localhost", 1244, filters)
with asyncio_patch("gns3server.compute.base_node.BaseNode._ubridge_apply_filters") as mock:
async_run(node.update_ubridge_udp_connection('VPCS-10', snio, dnio))
+18
View File
@@ -68,6 +68,24 @@ def test_cloud_nio_create_udp(http_compute, vm):
assert response.json["type"] == "nio_udp"
def test_cloud_nio_update_udp(http_compute, vm):
http_compute.post("/projects/{project_id}/cloud/nodes/{node_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_udp",
"lport": 4242,
"rport": 4343,
"rhost": "127.0.0.1"})
response = http_compute.put("/projects/{project_id}/cloud/nodes/{node_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]),
{
"type": "nio_udp",
"lport": 4242,
"rport": 4343,
"rhost": "127.0.0.1",
"filters": {}},
example=True)
assert response.status == 201, response.body.decode()
assert response.route == "/projects/{project_id}/cloud/nodes/{node_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio"
assert response.json["type"] == "nio_udp"
def test_cloud_delete_nio(http_compute, vm):
http_compute.post("/projects/{project_id}/cloud/nodes/{node_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_udp",
"lport": 4242,
+18
View File
@@ -69,6 +69,24 @@ def test_nat_nio_create_udp(http_compute, vm):
assert response.json["type"] == "nio_udp"
def test_nat_nio_update_udp(http_compute, vm):
http_compute.post("/projects/{project_id}/nat/nodes/{node_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_udp",
"lport": 4242,
"rport": 4343,
"rhost": "127.0.0.1"})
response = http_compute.put("/projects/{project_id}/nat/nodes/{node_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]),
{
"type": "nio_udp",
"lport": 4242,
"rport": 4343,
"rhost": "127.0.0.1",
"filters": {}},
example=True)
assert response.status == 201, response.body.decode()
assert response.route == "/projects/{project_id}/nat/nodes/{node_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio"
assert response.json["type"] == "nio_udp"
def test_nat_delete_nio(http_compute, vm):
with asyncio_patch("gns3server.compute.builtin.nodes.nat.Nat.add_nio"):
http_compute.post("/projects/{project_id}/nat/nodes/{node_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_udp",