Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #29 two errors of 2544 #30

Merged
merged 2 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugin2544/plugin/learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions plugin2544/plugin/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
)
Expand Down