@@ -69,16 +69,16 @@ def test_xcvrd_helper_class_run(self):
69
69
def test_post_port_dom_info_to_db (self ):
70
70
logical_port_name = "Ethernet0"
71
71
stop_event = threading .Event ()
72
- dom_tbl = Table ("state_db " , "dom_info_tbl" )
72
+ dom_tbl = Table ("STATE_DB " , TRANSCEIVER_DOM_SENSOR_TABLE )
73
73
post_port_dom_info_to_db (logical_port_name , dom_tbl , stop_event )
74
74
75
75
@patch ('xcvrd.xcvrd.logical_port_name_to_physical_port_list' , MagicMock (return_value = [0 ]))
76
76
@patch ('xcvrd.xcvrd._wrapper_get_presence' , MagicMock (return_value = True ))
77
77
def test_del_port_sfp_dom_info_from_db (self ):
78
78
logical_port_name = "Ethernet0"
79
79
stop_event = threading .Event ()
80
- dom_tbl = Table ("state_db " , "dom_info_tbl" )
81
- init_tbl = Table ("state_db " , "init_info_tbl" )
80
+ dom_tbl = Table ("STATE_DB " , TRANSCEIVER_DOM_SENSOR_TABLE )
81
+ init_tbl = Table ("STATE_DB " , TRANSCEIVER_INFO_TABLE )
82
82
del_port_sfp_dom_info_from_db (logical_port_name , init_tbl , dom_tbl )
83
83
84
84
@patch ('xcvrd.xcvrd.logical_port_name_to_physical_port_list' , MagicMock (return_value = [0 ]))
@@ -106,7 +106,7 @@ def test_del_port_sfp_dom_info_from_db(self):
106
106
def test_post_port_dom_threshold_info_to_db (self ):
107
107
logical_port_name = "Ethernet0"
108
108
stop_event = threading .Event ()
109
- dom_tbl = Table ("state_db " , "dom_info_tbl" )
109
+ dom_tbl = Table ("STATE_DB " , TRANSCEIVER_DOM_SENSOR_TABLE )
110
110
post_port_dom_threshold_info_to_db (logical_port_name , dom_tbl , stop_event )
111
111
112
112
@patch ('xcvrd.xcvrd.logical_port_name_to_physical_port_list' , MagicMock (return_value = [0 ]))
@@ -132,7 +132,7 @@ def test_post_port_dom_threshold_info_to_db(self):
132
132
def test_post_port_sfp_info_to_db (self ):
133
133
logical_port_name = "Ethernet0"
134
134
stop_event = threading .Event ()
135
- dom_tbl = Table ("state_db " , "dom_info_tbl" )
135
+ dom_tbl = Table ("STATE_DB " , TRANSCEIVER_DOM_SENSOR_TABLE )
136
136
transceiver_dict = {}
137
137
post_port_sfp_info_to_db (logical_port_name , dom_tbl , transceiver_dict , stop_event )
138
138
@@ -215,3 +215,103 @@ def test_post_port_sfp_dom_info_to_db(self):
215
215
def test_init_port_sfp_status_tbl (self ):
216
216
stop_event = threading .Event ()
217
217
init_port_sfp_status_tbl (stop_event )
218
+
219
+ @patch ('xcvrd.xcvrd_utilities.y_cable_helper.y_cable_platform_sfputil' , MagicMock (return_value = [0 ]))
220
+ @patch ('y_cable_helper.logical_port_name_to_physical_port_list' , MagicMock (return_value = [0 ]))
221
+ @patch ('y_cable_helper._wrapper_get_presence' , MagicMock (return_value = True ))
222
+ @patch ('y_cable_helper.get_muxcable_info' , MagicMock (return_value = {'tor_active' : 'self' ,
223
+ 'mux_direction' : 'self' ,
224
+ 'manual_switch_count' : '7' ,
225
+ 'auto_switch_count' : '71' ,
226
+ 'link_status_self' : 'up' ,
227
+ 'link_status_peer' : 'up' ,
228
+ 'link_status_nic' : 'up' ,
229
+ 'nic_lane1_active' : 'True' ,
230
+ 'nic_lane2_active' : 'True' ,
231
+ 'nic_lane3_active' : 'True' ,
232
+ 'nic_lane4_active' : 'True' ,
233
+ 'self_eye_height_lane1' : '500' ,
234
+ 'self_eye_height_lane2' : '510' ,
235
+ 'peer_eye_height_lane1' : '520' ,
236
+ 'peer_eye_height_lane2' : '530' ,
237
+ 'nic_eye_height_lane1' : '742' ,
238
+ 'nic_eye_height_lane2' : '750' ,
239
+ 'internal_temperature' : '28' ,
240
+ 'internal_voltage' : '3.3' ,
241
+ 'nic_temperature' : '20' ,
242
+ 'nic_voltage' : '2.7' ,
243
+ 'build_slot1_nic' : 'MS' ,
244
+ 'build_slot2_nic' : 'MS' ,
245
+ 'version_slot1_nic' : '1.7' ,
246
+ 'version_slot2_nic' : '1.7' ,
247
+ 'run_slot1_nic' : 'True' ,
248
+ 'run_slot2_nic' : 'False' ,
249
+ 'commit_slot1_nic' : 'True' ,
250
+ 'commit_slot2_nic' : 'False' ,
251
+ 'empty_slot1_nic' : 'True' ,
252
+ 'empty_slot2_nic' : 'False' ,
253
+ 'build_slot1_tor1' : 'MS' ,
254
+ 'build_slot2_tor1' : 'MS' ,
255
+ 'version_slot1_tor1' : '1.7' ,
256
+ 'version_slot2_tor1' : '1.7' ,
257
+ 'run_slot1_tor1' : 'True' ,
258
+ 'run_slot2_tor1' : 'False' ,
259
+ 'commit_slot1_tor1' : 'True' ,
260
+ 'commit_slot2_tor1' : 'False' ,
261
+ 'empty_slot1_tor1' : 'True' ,
262
+ 'empty_slot2_tor1' : 'False' ,
263
+ 'build_slot1_tor2' : 'MS' ,
264
+ 'build_slot2_tor2' : 'MS' ,
265
+ 'version_slot1_tor2' : '1.7' ,
266
+ 'version_slot2_tor2' : '1.7' ,
267
+ 'run_slot1_tor2' : 'True' ,
268
+ 'run_slot2_tor2' : 'False' ,
269
+ 'commit_slot1_tor2' : 'True' ,
270
+ 'commit_slot2_tor2' : 'False' ,
271
+ 'empty_slot1_tor2' : 'True' ,
272
+ 'empty_slot2_tor2' : 'False' }))
273
+ def test_post_port_mux_info_to_db (self ):
274
+ logical_port_name = "Ethernet0"
275
+ mux_tbl = Table ("STATE_DB" , y_cable_helper .MUX_CABLE_INFO_TABLE )
276
+ rc = post_port_mux_info_to_db (logical_port_name , mux_tbl )
277
+ assert (rc != - 1 )
278
+
279
+ @patch ('xcvrd.xcvrd_utilities.y_cable_helper.y_cable_platform_sfputil' , MagicMock (return_value = [0 ]))
280
+ @patch ('y_cable_helper.logical_port_name_to_physical_port_list' , MagicMock (return_value = [0 ]))
281
+ @patch ('y_cable_helper._wrapper_get_presence' , MagicMock (return_value = True ))
282
+ @patch ('y_cable_helper.get_muxcable_static_info' , MagicMock (return_value = {'read_side' : 'self' ,
283
+ 'nic_lane1_precursor1' : '1' ,
284
+ 'nic_lane1_precursor2' : '-7' ,
285
+ 'nic_lane1_maincursor' : '-1' ,
286
+ 'nic_lane1_postcursor1' : '11' ,
287
+ 'nic_lane1_postcursor2' : '11' ,
288
+ 'nic_lane2_precursor1' : '12' ,
289
+ 'nic_lane2_precursor2' : '7' ,
290
+ 'nic_lane2_maincursor' : '7' ,
291
+ 'nic_lane2_postcursor1' : '7' ,
292
+ 'nic_lane2_postcursor2' : '7' ,
293
+ 'tor_self_lane1_precursor1' : '17' ,
294
+ 'tor_self_lane1_precursor2' : '17' ,
295
+ 'tor_self_lane1_maincursor' : '17' ,
296
+ 'tor_self_lane1_postcursor1' : '17' ,
297
+ 'tor_self_lane1_postcursor2' : '17' ,
298
+ 'tor_self_lane2_precursor1' : '7' ,
299
+ 'tor_self_lane2_precursor2' : '7' ,
300
+ 'tor_self_lane2_maincursor' : '7' ,
301
+ 'tor_self_lane2_postcursor1' : '7' ,
302
+ 'tor_self_lane2_postcursor2' : '7' ,
303
+ 'tor_peer_lane1_precursor1' : '7' ,
304
+ 'tor_peer_lane1_precursor2' : '7' ,
305
+ 'tor_peer_lane1_maincursor' : '17' ,
306
+ 'tor_peer_lane1_postcursor1' : '7' ,
307
+ 'tor_peer_lane1_postcursor2' : '17' ,
308
+ 'tor_peer_lane2_precursor1' : '7' ,
309
+ 'tor_peer_lane2_precursor2' : '7' ,
310
+ 'tor_peer_lane2_maincursor' : '17' ,
311
+ 'tor_peer_lane2_postcursor1' : '7' ,
312
+ 'tor_peer_lane2_postcursor2' : '17' }))
313
+ def test_post_port_mux_static_info_to_db (self ):
314
+ logical_port_name = "Ethernet0"
315
+ mux_tbl = Table ("STATE_DB" , y_cable_helper .MUX_CABLE_STATIC_INFO_TABLE )
316
+ rc = post_port_mux_static_info_to_db (logical_port_name , mux_tbl )
317
+ assert (rc != - 1 )
0 commit comments