diff --git a/plugin2544/plugin/learning.py b/plugin2544/plugin/learning.py index 9318dfd..04e52c2 100644 --- a/plugin2544/plugin/learning.py +++ b/plugin2544/plugin/learning.py @@ -59,7 +59,7 @@ def get_bytes_from_macaddress(dmac: "MacAddress") -> Iterator[str]: def get_link_local_uci_ipv6address(dmac: "MacAddress") -> str: b = get_bytes_from_macaddress(dmac) - return f"FE80000000000000{int(next(b)) | 2 }{next(b)}{next(b)}FFFE{next(b)}{next(b)}{next(b)}" + return f"FE80000000000000{int(next(b), 16) | 2 }{next(b)}{next(b)}FFFE{next(b)}{next(b)}{next(b)}"[:-1] def get_address_list( @@ -125,7 +125,7 @@ async def get_address_learning_packet( packet = NDPPacket( smac=smac, source_ip=IPv6Address(source_ip), - destination_ip=IPv6Address(destination_ip), + destination_ip=IPv6Address(int(destination_ip, 16)), dmac=dmac, ).make_ndp_packet() packet_list.append(packet) diff --git a/plugin2544/plugin/structure.py b/plugin2544/plugin/structure.py index 6fdad6f..2910f1d 100644 --- a/plugin2544/plugin/structure.py +++ b/plugin2544/plugin/structure.py @@ -13,7 +13,6 @@ from .stream_struct import StreamStruct from ..utils import exceptions, constants as const from ..utils.field import MacAddress, NonNegativeDecimal - if TYPE_CHECKING: from xoa_core.core.test_suites.datasets import PortIdentity from xoa_driver import ports as xoa_ports, testers as xoa_testers @@ -108,7 +107,9 @@ async def set_broadr_reach_mode(self, broadr_reach_mode: const.BRRModeStr) -> No await self.port_ins.brr_mode.set(broadr_reach_mode.to_xmp()) async def set_mdi_mdix_mode(self, mdi_mdix_mode: const.MdiMdixMode) -> None: - if self.port_ins.info.capabilities.can_mdi_mdix == enums.YesNo.NO: + is_port_can_mdi_mdix = self.port_ins.info.capabilities.can_mdi_mdix == enums.YesNo.YES + is_port_can_set_speed = self.port_ins.info.port_possible_speed_modes + if not is_port_can_mdi_mdix or (is_port_can_mdi_mdix and not is_port_can_set_speed): self._xoa_out.send_warning( exceptions.MdiMdixModeNotSupport(self._port_identity.name) )