@@ -201,6 +201,111 @@ def test_is_copper(self):
201201 self .api .get_module_media_type .return_value = "sm_media_interface"
202202 assert not self .api .is_copper ()
203203
204+ @pytest .mark .parametrize ("mock_response, expected" , [
205+ # Test case 1: No application advertisement
206+ (None , False ),
207+ # Test case 2: Empty application advertisement
208+ ({}, False ),
209+ # Test case 3: Non-LPO host electrical interface
210+ ({
211+ 1 : {
212+ 'host_electrical_interface_id' : '400GAUI-8 C2M (Annex 120E)' , # ID 17, not LPO
213+ 'module_media_interface_id' : '400GBASE-DR4 (Cl 124)'
214+ }
215+ }, False ),
216+ # Test case 4: LPO host electrical interface LEI-100G-PAM4-1 (ID 32)
217+ ({
218+ 1 : {
219+ 'host_electrical_interface_id' : 'LEI-100G-PAM4-1' , # LPO
220+ 'module_media_interface_id' : '100GBASE-DR (Cl 140)'
221+ }
222+ }, True ),
223+ # Test case 5: LPO host electrical interface LEI-200G-PAM4-2 (ID 33)
224+ ({
225+ 1 : {
226+ 'host_electrical_interface_id' : 'LEI-200G-PAM4-2' , # LPO
227+ 'module_media_interface_id' : '200GBASE-DR2 (Clause 138)'
228+ }
229+ }, True ),
230+ # Test case 6: LPO host electrical interface LEI-400G-PAM4-4 (ID 34)
231+ ({
232+ 1 : {
233+ 'host_electrical_interface_id' : 'LEI-400G-PAM4-4' , # LPO
234+ 'module_media_interface_id' : '400GBASE-DR4 (Cl 124)'
235+ }
236+ }, True ),
237+ # Test case 7: LPO host electrical interface LEI-800G-PAM4-8 (ID 35)
238+ ({
239+ 1 : {
240+ 'host_electrical_interface_id' : 'LEI-800G-PAM4-8' , # LPO
241+ 'module_media_interface_id' : '800GBASE-DR8 (placeholder)'
242+ }
243+ }, True ),
244+ # Test case 8: LPO SM media interface 100G-DR1-LPO (ID 151)
245+ ({
246+ 1 : {
247+ 'host_electrical_interface_id' : '100GAUI-2 C2M (Annex 135G)' ,
248+ 'module_media_interface_id' : '100G-DR1-LPO' # LPO
249+ }
250+ }, True ),
251+ # Test case 9: LPO SM media interface 200G-DR2-LPO (ID 152)
252+ ({
253+ 1 : {
254+ 'host_electrical_interface_id' : '200GAUI-4 C2M (Annex 120E)' ,
255+ 'module_media_interface_id' : '200G-DR2-LPO' # LPO
256+ }
257+ }, True ),
258+ # Test case 10: LPO SM media interface 400G-DR4-LPO (ID 153)
259+ ({
260+ 1 : {
261+ 'host_electrical_interface_id' : '400GAUI-8 C2M (Annex 120E)' ,
262+ 'module_media_interface_id' : '400G-DR4-LPO' # LPO
263+ }
264+ }, True ),
265+ # Test case 11: LPO SM media interface 800G-DR8-LPO (ID 154)
266+ ({
267+ 1 : {
268+ 'host_electrical_interface_id' : '800GAUI-16 C2M (Annex 120C)' ,
269+ 'module_media_interface_id' : '800G-DR8-LPO' # LPO
270+ }
271+ }, True ),
272+ # Test case 12: Multiple applications, one with LPO
273+ ({
274+ 1 : {
275+ 'host_electrical_interface_id' : '400GAUI-8 C2M (Annex 120E)' , # Non-LPO
276+ 'module_media_interface_id' : '400GBASE-DR4 (Cl 124)'
277+ },
278+ 2 : {
279+ 'host_electrical_interface_id' : 'LEI-200G-PAM4-2' , # LPO
280+ 'module_media_interface_id' : '200GBASE-DR2 (Clause 138)'
281+ }
282+ }, True ),
283+ # Test case 13: Multiple LPO types (both host and media interfaces)
284+ ({
285+ 1 : {
286+ 'host_electrical_interface_id' : 'LEI-400G-PAM4-4' , # LPO
287+ 'module_media_interface_id' : '400G-DR4-LPO' # LPO
288+ }
289+ }, True ),
290+ # Test case 14: Application with missing keys
291+ ({
292+ 1 : {
293+ 'host_electrical_interface_id' : '100GAUI-2 C2M (Annex 135G)' ,
294+ # Missing module_media_interface_id
295+ },
296+ 2 : {
297+ # Missing host_electrical_interface_id
298+ 'module_media_interface_id' : '100GBASE-DR (Cl 140)'
299+ }
300+ }, False ),
301+ ])
302+ def test_is_lpo (self , mock_response , expected ):
303+ """Test is_lpo() method with various application advertisement scenarios"""
304+ with patch .object (self .api , 'get_application_advertisement' ) as mock_get_app_adv :
305+ mock_get_app_adv .return_value = mock_response
306+ result = self .api .is_lpo ()
307+ assert result == expected
308+
204309 @pytest .mark .parametrize ("mock_response, expected" , [
205310 (False , False )
206311 ])
0 commit comments