@@ -235,7 +235,8 @@ def test_us_channel_count_change(self, detector):
235235 assert len (ch_events ) == 1
236236 assert "US" in ch_events [0 ]["message" ]
237237
238- def test_modulation_change (self , detector ):
238+ def test_modulation_downgrade_warning (self , detector ):
239+ """256QAM → 64QAM = 2-level drop = warning"""
239240 ds1 = [{"channel_id" : 1 , "modulation" : "256QAM" , "power" : 3.0 , "snr" : 35.0 ,
240241 "correctable_errors" : 10 , "uncorrectable_errors" : 5 ,
241242 "docsis_version" : "3.0" , "health" : "good" , "health_detail" : "" , "frequency" : "602 MHz" }]
@@ -246,7 +247,40 @@ def test_modulation_change(self, detector):
246247 events = detector .check (_make_analysis (ds_total = 1 , ds_channels = ds2 ))
247248 mod_events = [e for e in events if e ["event_type" ] == "modulation_change" ]
248249 assert len (mod_events ) == 1
250+ assert mod_events [0 ]["severity" ] == "warning"
251+ assert "dropped" in mod_events [0 ]["message" ]
252+ assert mod_events [0 ]["details" ]["direction" ] == "downgrade"
253+
254+ def test_modulation_downgrade_critical (self , detector ):
255+ """256QAM → 16QAM = 4-level drop = critical"""
256+ ds1 = [{"channel_id" : 1 , "modulation" : "256QAM" , "power" : 3.0 , "snr" : 35.0 ,
257+ "correctable_errors" : 10 , "uncorrectable_errors" : 5 ,
258+ "docsis_version" : "3.0" , "health" : "good" , "health_detail" : "" , "frequency" : "602 MHz" }]
259+ ds2 = [{"channel_id" : 1 , "modulation" : "16QAM" , "power" : 3.0 , "snr" : 35.0 ,
260+ "correctable_errors" : 10 , "uncorrectable_errors" : 5 ,
261+ "docsis_version" : "3.0" , "health" : "good" , "health_detail" : "" , "frequency" : "602 MHz" }]
262+ detector .check (_make_analysis (ds_total = 1 , ds_channels = ds1 ))
263+ events = detector .check (_make_analysis (ds_total = 1 , ds_channels = ds2 ))
264+ mod_events = [e for e in events if e ["event_type" ] == "modulation_change" ]
265+ assert len (mod_events ) == 1
266+ assert mod_events [0 ]["severity" ] == "critical"
267+ assert "dropped" in mod_events [0 ]["message" ]
268+
269+ def test_modulation_upgrade_info (self , detector ):
270+ """64QAM → 256QAM = upgrade = info"""
271+ ds1 = [{"channel_id" : 1 , "modulation" : "64QAM" , "power" : 3.0 , "snr" : 35.0 ,
272+ "correctable_errors" : 10 , "uncorrectable_errors" : 5 ,
273+ "docsis_version" : "3.0" , "health" : "good" , "health_detail" : "" , "frequency" : "602 MHz" }]
274+ ds2 = [{"channel_id" : 1 , "modulation" : "256QAM" , "power" : 3.0 , "snr" : 35.0 ,
275+ "correctable_errors" : 10 , "uncorrectable_errors" : 5 ,
276+ "docsis_version" : "3.0" , "health" : "good" , "health_detail" : "" , "frequency" : "602 MHz" }]
277+ detector .check (_make_analysis (ds_total = 1 , ds_channels = ds1 ))
278+ events = detector .check (_make_analysis (ds_total = 1 , ds_channels = ds2 ))
279+ mod_events = [e for e in events if e ["event_type" ] == "modulation_change" ]
280+ assert len (mod_events ) == 1
249281 assert mod_events [0 ]["severity" ] == "info"
282+ assert "improved" in mod_events [0 ]["message" ]
283+ assert mod_events [0 ]["details" ]["direction" ] == "upgrade"
250284
251285 def test_error_spike (self , detector ):
252286 detector .check (_make_analysis (ds_uncorrectable_errors = 100 ))
0 commit comments