예제 #1
0
def test_mac_command(async_run):
    node = AsyncioMagicMock()
    node.name = "Test"
    node.nios = {}
    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].name = "Ethernet1"
예제 #2
0
def test_update_ubridge_udp_connection(node, async_run):
    filters = {"latency": [10]}

    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))
    mock.assert_called_with("VPCS-10", filters)
예제 #3
0
def test_update_ubridge_udp_connection(node, async_run):
    filters = {
        "latency": [10]
    }

    snio = NIOUDP(1245, "localhost", 1246)
    dnio = NIOUDP(1245, "localhost", 1244)
    dnio.filters = 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))
    mock.assert_called_with("VPCS-10", filters)
예제 #4
0
def test_mac_command(async_run):
    node = AsyncioMagicMock()
    node.name = "Test"
    node.nios = {}
    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].name = "Ethernet1"
    node._hypervisor.send = AsyncioMagicMock(return_value=[
        "0050.7966.6801  1  Ethernet0", "0050.7966.6802  1  Ethernet1"
    ])
    console = EthernetSwitchConsole(node)
    assert async_run(console.mac()) == \
        "Port       Mac                VLAN\n" \
        "Ethernet0  00:50:79:66:68:01  1\n" \
        "Ethernet1  00:50:79:66:68:02  1\n"
    node._hypervisor.send.assert_called_with("ethsw show_mac_addr_table Test")
예제 #5
0
def nio():
    return NIOUDP(4242, "127.0.0.1", 4343)