mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-16 11:00:58 +00:00
Fix test for ethernet switch show arp
This commit is contained in:
parent
3ed055dbb9
commit
bcdac6c969
@ -99,10 +99,6 @@ class EthernetSwitch(Device):
|
|||||||
else:
|
else:
|
||||||
self._ports = ports
|
self._ports = ports
|
||||||
|
|
||||||
@property
|
|
||||||
def console(self):
|
|
||||||
return self._console
|
|
||||||
|
|
||||||
def __json__(self):
|
def __json__(self):
|
||||||
|
|
||||||
ethernet_switch_info = {"name": self.name,
|
ethernet_switch_info = {"name": self.name,
|
||||||
|
@ -17,15 +17,21 @@
|
|||||||
|
|
||||||
from tests.utils import AsyncioMagicMock
|
from tests.utils import AsyncioMagicMock
|
||||||
from gns3server.compute.dynamips.nodes.ethernet_switch import EthernetSwitchConsole
|
from gns3server.compute.dynamips.nodes.ethernet_switch import EthernetSwitchConsole
|
||||||
|
from gns3server.compute.nios.nio_udp import NIOUDP
|
||||||
|
|
||||||
|
|
||||||
def test_arp_command(async_run):
|
def test_arp_command(async_run):
|
||||||
node = AsyncioMagicMock()
|
node = AsyncioMagicMock()
|
||||||
node.name = "Test"
|
node.name = "Test"
|
||||||
node._hypervisor.send = AsyncioMagicMock(return_value=["0050.7966.6801 1 nio1", "0050.7966.6802 1 nio2"])
|
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)
|
console = EthernetSwitchConsole(node)
|
||||||
assert async_run(console.arp()) == \
|
assert async_run(console.arp()) == \
|
||||||
"Mac VLAN\n" \
|
"Port Mac VLAN\n" \
|
||||||
"00:50:79:66:68:01 1\n" \
|
"Ethernet0 00:50:79:66:68:01 1\n" \
|
||||||
"00:50:79:66:68:02 1\n"
|
"Ethernet1 00:50:79:66:68:02 1\n"
|
||||||
node._hypervisor.send.assert_called_with("ethsw show_mac_addr_table Test")
|
node._hypervisor.send.assert_called_with("ethsw show_mac_addr_table Test")
|
||||||
|
Loading…
Reference in New Issue
Block a user