Skip to content

Commit

Permalink
tests: per-layer tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
peremen committed Apr 19, 2024
1 parent 0cf60de commit a299602
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 32 deletions.
4 changes: 4 additions & 0 deletions tests/test_diaggsmlogparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def test_parse_gsm_rr_msg(self):
result = self.parser.parse_gsm_rr(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('0204010000000000000000000100000049061b761762f2200141c8010a156544b800004e072b2b')],
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc),
'layer': 'rrc',
'radio_id': 0}
self.assertDictEqual(result, expected)

Expand All @@ -99,6 +100,7 @@ def test_parse_gsm_rr_msg(self):
result = self.parser.parse_gsm_rr(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('0204010000000000000000000200000031063f100f707c7f502601010f4f3112050480e02b2b2b')],
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc),
'layer': 'rrc',
'radio_id': 0}
self.assertDictEqual(result, expected)

Expand All @@ -107,6 +109,7 @@ def test_parse_gsm_rr_msg(self):
result = self.parser.parse_gsm_rr(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('020401000000000000000000020000001506210001f02b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b')],
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc),
'layer': 'rrc',
'radio_id': 0}
self.assertDictEqual(result, expected)

Expand All @@ -115,6 +118,7 @@ def test_parse_gsm_rr_msg(self):
result = self.parser.parse_gsm_rr(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('0204010000000000000000000100000005060764a0312aa5d047fbfe01ff04332b2b2b2b2b2b2b')],
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc),
'layer': 'rrc',
'radio_id': 0}
self.assertDictEqual(result, expected)

Expand Down
17 changes: 17 additions & 0 deletions tests/test_diagltelogparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def test_parse_lte_ml1_cell_info(self):
result = self.parser.parse_lte_ml1_cell_info(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d00051400000000000004000000a9a400')],
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc),
'layer': 'rrc',
'stdout': 'LTE ML1 Cell Info: EARFCN 1300, PCI 36, Bandwidth 20 MHz, Num antennas 1'}
self.assertDictEqual(result, expected)

Expand All @@ -68,6 +69,7 @@ def test_parse_lte_ml1_cell_info(self):
result = self.parser.parse_lte_ml1_cell_info(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d0007210000000000000400000084f800')],
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc),
'layer': 'rrc',
'stdout': 'LTE ML1 Cell Info: EARFCN 1825, PCI 259, Bandwidth 15 MHz, Num antennas 1'}
self.assertDictEqual(result, expected)

Expand All @@ -90,6 +92,7 @@ def test_parse_lte_mac_rach_response(self):
result = self.parser.parse_lte_mac_rach_response(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040e00000000000000000000000000010102091b01015b004c01001a23'),
binascii.unhexlify('02040e00000000000000000000000000010003021a23091b010100465c80bd0648000000')],
'layer': 'mac',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)

Expand All @@ -100,6 +103,7 @@ def test_parse_lte_mac_rach_response(self):
result = self.parser.parse_lte_mac_rach_response(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040e00000000000000000000000000010102091801015800b2000061c6'),
binascii.unhexlify('02040e000000000000000000000000000100030261c60918010120061f423f8d95075800')],
'layer': 'mac',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)

Expand All @@ -112,6 +116,7 @@ def test_parse_lte_mac_dl_block(self):
binascii.unhexlify('02040e00000000000000000000000000010103042728013c201d1f408c61ca51e6'),
binascii.unhexlify('02040e00000000000000000000000000010103042745013d1f1f'),
binascii.unhexlify('02040e000000000000000000000000000101030427490121021f')],
'layer': 'mac',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)

Expand All @@ -125,6 +130,7 @@ def test_parse_lte_mac_dl_block(self):
binascii.unhexlify('02040e00000000000000000000000000010103041d020124809f1f'),
binascii.unhexlify('02040e00000000000000000000000000010103041d060124581f'),
binascii.unhexlify('02040e00000000000000000000000000010103041d080104')],
'layer': 'mac',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)

Expand All @@ -142,6 +148,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d001419000000000ad1010006004c10')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)

Expand All @@ -156,6 +163,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d000713000000000000030000001015')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)
# V25
Expand All @@ -170,6 +178,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d000ce4000000000dc00600090040858ec4e5bfe050dc29151600')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)
# V20
Expand All @@ -178,6 +187,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d00189c000000000000030000000810a7145359a6054368c03bda3004a688028da2009a6840')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)
# V19
Expand All @@ -186,6 +196,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d0009fa00000000000010000000281840160808800000')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)
# V15
Expand All @@ -194,6 +205,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d0005140000000008c406000900400c8ec94289e0')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)
# V15
Expand All @@ -202,6 +214,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d000514000000000000030000000810a5346141a31c316804401a0049167c23159f001067c106d9e000')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)
# V13
Expand All @@ -210,6 +223,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d001838000000000000030000002c00')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)
# V9
Expand All @@ -218,6 +232,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d00051400000000091006000900400b8ec1dd13b0')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)
# V8
Expand All @@ -226,6 +241,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d00189c00000000033a010009002e02')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)

Expand All @@ -235,6 +251,7 @@ def test_parse_lte_rrc(self):
log_id=diagcmd.diag_log_get_lte_item_id(diagcmd.diag_log_code_lte.LOG_LTE_RRC_OTA_MESSAGE), timestamp=0)
result = self.parser.parse_lte_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040d00072c0000000003420500050040498805c09702d3b0981c20a0818c4326d0')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_diagwcdmalogparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ def test_parse_wcdma_rrc(self):
pkt_header = self.log_header(cmd_code=0x10, reserved=0, length1=len(payload) + 12, length2=len(payload) + 12, log_id=0x412f, timestamp=0)
result = self.parser.parse_wcdma_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040c0029a700000000000008000000a143f686e52a22282f36928cc1852026d2519830afacda4a330614909b4944')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)

payload = binascii.unhexlify('89282a00a7298d014365010240c80ea200618385110030071ba8801819c954400c1a2d7220049e22178885e22178885e2210')
pkt_header = self.log_header(cmd_code=0x10, reserved=0, length1=len(payload) + 12, length2=len(payload) + 12, log_id=0x412f, timestamp=0)
result = self.parser.parse_wcdma_rrc(pkt_header, payload, None)
expected = {'cp': [binascii.unhexlify('02040c0029a70000000000003600000065010240c80ea200618385110030071ba8801819c954400c1a2d7220049e22178885e22178885e2210')],
'layer': 'rrc',
'ts': datetime.datetime(1980, 1, 6, 0, 0, tzinfo=datetime.timezone.utc)}
self.assertDictEqual(result, expected)

Expand Down
Loading

0 comments on commit a299602

Please sign in to comment.