예제 #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_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")
예제 #3
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")