Merge 2907cc8c5f
into 610685d27b
This commit is contained in:
commit
ece3a52464
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES.
|
# Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||||
# Apache-2.0
|
# Apache-2.0
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -329,7 +329,13 @@ class Chassis(ChassisBase):
|
|||||||
Returns:
|
Returns:
|
||||||
An integer, the number of sfps available on this chassis
|
An integer, the number of sfps available on this chassis
|
||||||
"""
|
"""
|
||||||
return DeviceDataManager.get_sfp_count()
|
if not self._RJ45_port_inited:
|
||||||
|
self._RJ45_port_list = extract_RJ45_ports_index()
|
||||||
|
self._RJ45_port_inited = True
|
||||||
|
if self._RJ45_port_list is not None:
|
||||||
|
return DeviceDataManager.get_sfp_count() + len(self._RJ45_port_list)
|
||||||
|
else:
|
||||||
|
return DeviceDataManager.get_sfp_count()
|
||||||
|
|
||||||
def get_all_sfps(self):
|
def get_all_sfps(self):
|
||||||
"""
|
"""
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES.
|
# Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||||
# Apache-2.0
|
# Apache-2.0
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -169,6 +169,13 @@ class TestChassis:
|
|||||||
assert len(sfp_list) == 3
|
assert len(sfp_list) == 3
|
||||||
assert chassis.sfp_initialized_count == 3
|
assert chassis.sfp_initialized_count == 3
|
||||||
|
|
||||||
|
# Get all SFPs, with RJ45 ports
|
||||||
|
sonic_platform.chassis.extract_RJ45_ports_index = mock.MagicMock(return_value=[0,1,2])
|
||||||
|
DeviceDataManager.get_sfp_count = mock.MagicMock(return_value=3)
|
||||||
|
chassis = Chassis()
|
||||||
|
assert chassis.get_num_sfps() == 6
|
||||||
|
sonic_platform.chassis.extract_RJ45_ports_index = mock.MagicMock(return_value=[])
|
||||||
|
|
||||||
def test_create_sfp_in_multi_thread(self):
|
def test_create_sfp_in_multi_thread(self):
|
||||||
DeviceDataManager.get_sfp_count = mock.MagicMock(return_value=3)
|
DeviceDataManager.get_sfp_count = mock.MagicMock(return_value=3)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user