def test_002_sdcch4 (self):
        
        bursts_expected = [
            '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000',
            '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000',
            '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000',
            '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000',
            '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000',
            '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000',
            '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000',
            '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000',
            '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000',
            '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000',
            '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000',
            '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000',
        ]
        
        subslot = 2
        src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input, self.bursts_input)
        splitter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH4, subslot)
        sink = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", splitter, "in")
        self.tb.msg_connect(splitter, "out", sink, "in")

        self.tb.run ()

        bursts_result = list(sink.get_burst_data())
        
        self.assertEqual(bursts_result, bursts_expected)
Пример #2
0
    def test_008_complete_prefix_fnr_fcount (self):
        """
            Complete bursts, no prefix, with frame number, frame count, and ignoring dummy bursts
            Bursts 4-7 are dummy bursts
        """
        framenumbers_input = [2569043, 2569044, 2569045, 2569046, 1099602, 1099603, 1099604, 1099605]
        timeslots_input = [2, 2, 2, 2, 4, 4, 4, 4]
        bursts_input = [
            "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000",
            "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000",
            "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000",
            "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000"
            
        ]
        
        expected_lines = [
            "test_008: 2569043 3967625: 0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000",
            "test_008: 2569044 3967658: 0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000",
            "test_008: 2569045 3967691: 0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000",
            "test_008: 2569046 3967724: 0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000"
        ]
        
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        printer = grgsm.bursts_printer(pmt.intern("test_008: "), True, True, False, True)
        self.tb.msg_connect(src, "out", printer, "bursts")
        self.tb.run()

        self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines))
Пример #3
0
    def test_005_complete_bursts_fnr_fcount (self):
        """
            Complete bursts, no prefix, with frame number and frame count
        """
        framenumbers_input = [2569043, 2569044, 2569045, 2569046]
        timeslots_input = [2, 2, 2, 2]
        bursts_input = [
            "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000",
            "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000",
            "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000",
            "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000"
        ]
        
        expected_lines = [
            "2569043 3967625: 0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000",
            "2569044 3967658: 0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000",
            "2569045 3967691: 0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000",
            "2569046 3967724: 0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000"
        ]
        
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        printer = grgsm.bursts_printer(pmt.intern(""), True, True, False, False)
        self.tb.msg_connect(src, "out", printer, "bursts")
        self.tb.run()

        self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines))
Пример #4
0
    def test_002_complete_bursts_prefix (self):
        """
            Complete bursts, with a string prefix
        """
        framenumbers_input = [2569043, 2569044, 2569045, 2569046]
        timeslots_input = [2, 2, 2, 2]
        bursts_input = [
            "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000",
            "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000",
            "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000",
            "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000"
        ]
        
        expected_lines = [
            "Test 0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000",
            "Test 0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000",
            "Test 0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000",
            "Test 0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000"
        ]
        
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        printer = grgsm.bursts_printer(pmt.intern("Test "), False, False, False, False)
        self.tb.msg_connect(src, "out", printer, "bursts")
        self.tb.run()

        self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines))
    def test_002_sdcch4(self):

        bursts_expected = [
            '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000',
            '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000',
            '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000',
            '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000',
            '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000',
            '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000',
            '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000',
            '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000',
            '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000',
            '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000',
            '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000',
            '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000',
        ]

        subslot = 2
        src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input,
                                 self.bursts_input)
        splitter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH4,
                                                    subslot)
        sink = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", splitter, "in")
        self.tb.msg_connect(splitter, "out", sink, "in")

        self.tb.run()

        bursts_result = list(sink.get_burst_data())

        self.assertEqual(bursts_result, bursts_expected)
Пример #6
0
    def test_001 (self):
        """
            24 random framenumbers, timeslots and bursts as input
        """
        framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270]
        timeslots_input = [6, 1, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 1, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7]
        bursts_input = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
            "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
            "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
            "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
            "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
            "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000"
        ]

        bursts_expected = [
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000"
        ]

        timeslot = 1
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        ts_filter = grgsm.burst_timeslot_filter(timeslot)
        sink = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", ts_filter, "in")
        self.tb.msg_connect(ts_filter, "out", sink, "in")

        self.tb.run ()

        bursts_result = list(sink.get_burst_data())
        
        self.assertEqual(bursts_expected, bursts_result)
    def test_uplink(self):
        """
           BCCH_CCCH demapper uplink test
        """
        src = grgsm.burst_source(test_data.frames, test_data.timeslots,
                                 test_data.bursts)
        src.set_arfcn(0x2240)
        #uplink flag is 40
        demapper = grgsm.gsm_bcch_ccch_demapper(timeslot_nr=0)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", demapper, "bursts")
        self.tb.msg_connect(demapper, "bursts", dst, "in")
        self.tb.run()

        b = test_data.bursts
        self.assertEqual(b, list(dst.get_burst_data()))
        self.assertEqual([3] * len(b), list(dst.get_sub_types()))
        self.assertEqual([0] * len(b), list(dst.get_sub_slots()))
Пример #8
0
    def test_002_a51(self):
        """
            A TMSI Reallocation command on SDCCH/8, encrypted with A5/1
        """
        framenumbers_input = [2569043, 2569044, 2569045, 2569046]
        timeslots_input = [4, 4, 4, 4]
        bursts_input = [
            "0000111101111110011111000111000100110100001101100001000110011000110101110010000011010111010110101100100010011000000100111010001000011000010010010000",
            "0001010010001100110000000111100110101111001001101111000000101000110101110010000011010111001101001101000001000001110101101100101111010011001000111000",
            "0001110111101000110100001111000010100001101011000001010010011000110101110010000011010111101110000011100010110110101010100101010011011111111001000000",
            "0001111011000100011010100010000110001101111001000110010100001000110101110010000011010111000100101011110110000100110110001110010011110110110101100000"
        ]
        bursts_expected = [
            "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000",
            "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000",
            "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000",
            "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000"
        ]

        key = [0xAD, 0x6A, 0x3E, 0xC2, 0xB4, 0x42, 0xE4, 0x00]
        a5_version = 1

        src = grgsm.burst_source(framenumbers_input, timeslots_input,
                                 bursts_input)
        decryption = grgsm.decryption((key), a5_version)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", decryption, "bursts")
        self.tb.msg_connect(decryption, "bursts", dst, "in")

        self.tb.run()

        # have to convert tuple to list
        framenumbers_result = list(dst.get_framenumbers())
        timeslots_result = list(dst.get_timeslots())
        bursts_result = list(dst.get_burst_data())

        self.assertEqual(framenumbers_input, framenumbers_result)
        self.assertEqual(timeslots_input, timeslots_result)
        self.assertEqual(bursts_expected, bursts_result)
Пример #9
0
    def test_001_a51(self):
        """
            A system information message on the SACCH of TCH/F, encrypted with A5/1
        """
        framenumbers_input = [1259192, 1259218, 1259244, 1259270]
        timeslots_input = [2, 2, 2, 2]
        bursts_input = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000"
        ]
        bursts_expected = [
            "0000010111000110010001010000000101010011110101100000100000011101001111101100010100111111010110110000000001101110000101000000000101000100011000110000",
            "0000010110101100010100111101011001000000000101010011000100001101001111101100010100111111011001101001110000100001000110000000101100010111100111010000",
            "0000011110110111011011100001010000000000110100100000100001001101001111101100010100111111100010000000000000001101000000100000010011001110100000010000",
            "0000011000010001000000001101000001001001000010001000000000001101001111101100010100111111000010110001001110000000110111001110010000010111000111001000"
        ]

        key = [0x32, 0xE5, 0x45, 0x53, 0x20, 0x8C, 0xE0, 0x00]
        a5_version = 1

        src = grgsm.burst_source(framenumbers_input, timeslots_input,
                                 bursts_input)
        decryption = grgsm.decryption((key), a5_version)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", decryption, "bursts")
        self.tb.msg_connect(decryption, "bursts", dst, "in")

        self.tb.run()

        # have to convert tuple to list
        framenumbers_result = list(dst.get_framenumbers())
        timeslots_result = list(dst.get_timeslots())
        bursts_result = list(dst.get_burst_data())

        self.assertEqual(framenumbers_input, framenumbers_result)
        self.assertEqual(timeslots_input, timeslots_result)
        self.assertEqual(bursts_expected, bursts_result)
Пример #10
0
    def test_004_a53(self):
        """
            An assignment command for a TCH channel, encrypted with A5/3
        """
        framenumbers_input = [435897, 435898, 435899, 435900]
        timeslots_input = [2, 2, 2, 2]
        bursts_input = [
            "0001001000010110001000001101001010100000011100011011110101011101001111101100010100111111010000100000100101101111000010001100001000100101100101010000",
            "0000011101010011010110101000011011101010100001011001100011001101001111101100010100111111000110011001110101110111000100101001111100110100011011011000",
            "0000000000110011000001110101110101111011011111000111101001011101001111101100010100111111101100010011010000010001101101000110000011011000011100011000",
            "0000000001110011001010110101100110100111110010000101001011111101001111101100010100111111101110001101111111001001001000101101010110010101010110100000",
        ]
        bursts_expected = [
            "0001101100011001110111101010110000001111000010110011000110101101001111101100010100111111100010000011100010101001010110101100001111101111110010011000",
            "0001101001110110000111000011111110011011001001101010011000001101001111101100010100111111110010001001001001101011111010010100100011100110110000011000",
            "0001000001110000001011101010011010010100010010100110010010001101001111101100010100111111010011011101010110100000111111011111100000010100000111000000",
            "0000001000001010010001010000101011101100100100001010011101111101001111101100010100111111000001001001100100101010000011101010100001110000100000001000"
        ]

        key = [0xAD, 0x2C, 0xB3, 0x83, 0x2F, 0x4A, 0x6C, 0xF1]
        a5_version = 3

        src = grgsm.burst_source(framenumbers_input, timeslots_input,
                                 bursts_input)
        decryption = grgsm.decryption((key), a5_version)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", decryption, "bursts")
        self.tb.msg_connect(decryption, "bursts", dst, "in")

        self.tb.run()

        # have to convert tuple to list
        framenumbers_result = list(dst.get_framenumbers())
        timeslots_result = list(dst.get_timeslots())
        bursts_result = list(dst.get_burst_data())

        self.assertEqual(framenumbers_input, framenumbers_result)
        self.assertEqual(timeslots_input, timeslots_result)
        self.assertEqual(bursts_expected, bursts_result)
Пример #11
0
    def test_003_a53(self):
        """
            A cp-ack message of a SMS, encrypted with A5/3
        """
        framenumbers_input = [1935011, 1935012, 1935013, 1935014]
        timeslots_input = [2, 2, 2, 2]
        bursts_input = [
            "0001111001001110001101111101111111110100011010101100100001011101001111101100010100111111101101011110100011101111001000110110100101101011110010100000",
            "0001111000110011010110000111010010100101001100111011000001011101001111101100010100111111000100101000001011010001100000010100011000011111001111011000",
            "0000000110100101110010011101101100101110001100000000101001011101001111101100010100111111100100100010110110111011010101010001001100010100100100111000",
            "0000011100111011101010000111001010010001100110011011100101011101001111101100010100111111101110110100101101010100111101000000111001011011100010101000"
        ]
        bursts_expected = [
            "0001000000000010100111000010010101001010011110010010101110011101001111101100010100111111011010111010111100110000011100111010001010100010100110000000",
            "0000101110001111011110100111101010000000101101101011101001011101001111101100010100111111010110100111001100100011000100100011110101001010110001001000",
            "0000001111011010110111000100111111000011001010100011000110011101001111101100010100111111100111100010011100000010110011100001101000000000000011001000",
            "0000011011100010001000101000101010010011010000100011110011001101001111101100010100111111010100100010010100111010101110001101101110101110011100101000"
        ]

        key = [0x41, 0xBC, 0x19, 0x30, 0xB6, 0x31, 0x8A, 0xC8]
        a5_version = 3

        src = grgsm.burst_source(framenumbers_input, timeslots_input,
                                 bursts_input)
        decryption = grgsm.decryption((key), a5_version)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", decryption, "bursts")
        self.tb.msg_connect(decryption, "bursts", dst, "in")

        self.tb.run()

        # have to convert tuple to list
        framenumbers_result = list(dst.get_framenumbers())
        timeslots_result = list(dst.get_timeslots())
        bursts_result = list(dst.get_burst_data())

        self.assertEqual(framenumbers_input, framenumbers_result)
        self.assertEqual(timeslots_input, timeslots_result)
        self.assertEqual(bursts_expected, bursts_result)
Пример #12
0
    def test_002_a51 (self):
        """
            A TMSI Reallocation command on SDCCH/8, encrypted with A5/1
        """
        framenumbers_input = [2569043, 2569044, 2569045, 2569046]
        timeslots_input = [4, 4, 4, 4]
        bursts_input = [
            "0000111101111110011111000111000100110100001101100001000110011000110101110010000011010111010110101100100010011000000100111010001000011000010010010000",
            "0001010010001100110000000111100110101111001001101111000000101000110101110010000011010111001101001101000001000001110101101100101111010011001000111000",
            "0001110111101000110100001111000010100001101011000001010010011000110101110010000011010111101110000011100010110110101010100101010011011111111001000000",
            "0001111011000100011010100010000110001101111001000110010100001000110101110010000011010111000100101011110110000100110110001110010011110110110101100000"
        ]
        bursts_expected = [
            "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000",
            "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000",
            "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000",
            "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000"
        ]
                
        key = [0xAD,0x6A,0x3E,0xC2,0xB4,0x42,0xE4,0x00]
        a5_version = 1
        
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        decryption = grgsm.decryption((key), a5_version)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", decryption, "bursts")
        self.tb.msg_connect(decryption, "bursts", dst, "in")
        
        self.tb.run ()
                
        # have to convert tuple to list
        framenumbers_result = list(dst.get_framenumbers())
        timeslots_result = list(dst.get_timeslots())
        bursts_result = list(dst.get_burst_data())
        
        self.assertEqual(framenumbers_input, framenumbers_result)
        self.assertEqual(timeslots_input, timeslots_result)
        self.assertEqual(bursts_expected, bursts_result)
Пример #13
0
    def test_001_a51 (self):
        """
            A system information message on the SACCH of TCH/F, encrypted with A5/1
        """
        framenumbers_input = [1259192, 1259218, 1259244, 1259270]
        timeslots_input = [2, 2, 2, 2]
        bursts_input = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000"
        ]
        bursts_expected = [
            "0000010111000110010001010000000101010011110101100000100000011101001111101100010100111111010110110000000001101110000101000000000101000100011000110000",
            "0000010110101100010100111101011001000000000101010011000100001101001111101100010100111111011001101001110000100001000110000000101100010111100111010000",
            "0000011110110111011011100001010000000000110100100000100001001101001111101100010100111111100010000000000000001101000000100000010011001110100000010000",
            "0000011000010001000000001101000001001001000010001000000000001101001111101100010100111111000010110001001110000000110111001110010000010111000111001000"
        ]

        key = [0x32,0xE5,0x45,0x53,0x20,0x8C,0xE0,0x00]
        a5_version = 1

        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        decryption = grgsm.decryption((key), a5_version)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", decryption, "bursts")
        self.tb.msg_connect(decryption, "bursts", dst, "in")

        self.tb.run ()

        # have to convert tuple to list
        framenumbers_result = list(dst.get_framenumbers())
        timeslots_result = list(dst.get_timeslots())
        bursts_result = list(dst.get_burst_data())
        
        self.assertEqual(framenumbers_input, framenumbers_result)
        self.assertEqual(timeslots_input, timeslots_result)
        self.assertEqual(bursts_expected, bursts_result)
Пример #14
0
    def test_003_a53 (self):
        """
            A cp-ack message of a SMS, encrypted with A5/3
        """
        framenumbers_input = [1935011, 1935012, 1935013, 1935014]
        timeslots_input = [2, 2, 2, 2]
        bursts_input = [
            "0001111001001110001101111101111111110100011010101100100001011101001111101100010100111111101101011110100011101111001000110110100101101011110010100000",
            "0001111000110011010110000111010010100101001100111011000001011101001111101100010100111111000100101000001011010001100000010100011000011111001111011000",
            "0000000110100101110010011101101100101110001100000000101001011101001111101100010100111111100100100010110110111011010101010001001100010100100100111000",
            "0000011100111011101010000111001010010001100110011011100101011101001111101100010100111111101110110100101101010100111101000000111001011011100010101000"
        ]
        bursts_expected = [
            "0001000000000010100111000010010101001010011110010010101110011101001111101100010100111111011010111010111100110000011100111010001010100010100110000000",
            "0000101110001111011110100111101010000000101101101011101001011101001111101100010100111111010110100111001100100011000100100011110101001010110001001000",
            "0000001111011010110111000100111111000011001010100011000110011101001111101100010100111111100111100010011100000010110011100001101000000000000011001000",
            "0000011011100010001000101000101010010011010000100011110011001101001111101100010100111111010100100010010100111010101110001101101110101110011100101000"
        ]
                
        key = [0x41,0xBC,0x19,0x30,0xB6,0x31,0x8A,0xC8]
        a5_version = 3
        
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        decryption = grgsm.decryption((key), a5_version)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", decryption, "bursts")
        self.tb.msg_connect(decryption, "bursts", dst, "in")
        
        self.tb.run ()
                
        # have to convert tuple to list
        framenumbers_result = list(dst.get_framenumbers())
        timeslots_result = list(dst.get_timeslots())
        bursts_result = list(dst.get_burst_data())
        
        self.assertEqual(framenumbers_input, framenumbers_result)
        self.assertEqual(timeslots_input, timeslots_result)
        self.assertEqual(bursts_expected, bursts_result)
Пример #15
0
    def test_004_a53 (self):
        """
            An assignment command for a TCH channel, encrypted with A5/3
        """
        framenumbers_input = [435897, 435898, 435899, 435900]
        timeslots_input = [2, 2, 2, 2]
        bursts_input = [
            "0001001000010110001000001101001010100000011100011011110101011101001111101100010100111111010000100000100101101111000010001100001000100101100101010000",
            "0000011101010011010110101000011011101010100001011001100011001101001111101100010100111111000110011001110101110111000100101001111100110100011011011000",
            "0000000000110011000001110101110101111011011111000111101001011101001111101100010100111111101100010011010000010001101101000110000011011000011100011000",
            "0000000001110011001010110101100110100111110010000101001011111101001111101100010100111111101110001101111111001001001000101101010110010101010110100000",
        ]
        bursts_expected = [
            "0001101100011001110111101010110000001111000010110011000110101101001111101100010100111111100010000011100010101001010110101100001111101111110010011000",
            "0001101001110110000111000011111110011011001001101010011000001101001111101100010100111111110010001001001001101011111010010100100011100110110000011000",
            "0001000001110000001011101010011010010100010010100110010010001101001111101100010100111111010011011101010110100000111111011111100000010100000111000000",
            "0000001000001010010001010000101011101100100100001010011101111101001111101100010100111111000001001001100100101010000011101010100001110000100000001000"
        ]
                
        key = [0xAD,0x2C,0xB3,0x83,0x2F,0x4A,0x6C,0xF1]
        a5_version = 3
        
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        decryption = grgsm.decryption((key), a5_version)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", decryption, "bursts")
        self.tb.msg_connect(decryption, "bursts", dst, "in")
        
        self.tb.run ()
                
        # have to convert tuple to list
        framenumbers_result = list(dst.get_framenumbers())
        timeslots_result = list(dst.get_timeslots())
        bursts_result = list(dst.get_burst_data())
        
        self.assertEqual(framenumbers_input, framenumbers_result)
        self.assertEqual(timeslots_input, timeslots_result)
        self.assertEqual(bursts_expected, bursts_result)
Пример #16
0
    def test_006_payload_prefix_fnr_fcount (self):
        """
            Payload only, no prefix, with frame number and frame count
            Bursts 4-7 are dummy bursts
        """
        framenumbers_input = [2569043, 2569044, 2569045, 2569046, 1099602, 1099603, 1099604, 1099605]
        timeslots_input = [2, 2, 2, 2, 4, 4, 4, 4]
        bursts_input = [
            "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000",
            "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000",
            "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000",
            "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000"
            
        ]
        
        expected_lines = [
            "test_006: 2569043 3967625: 110000001001001111011111001111100000000101000111100000000100101101010000001111010100010110111101011101011100000101",
            "test_006: 2569044 3967658: 100010111110111111000001010000101101111101011111010101110110110111101101111110000011011010111011111001011101000011",
            "test_006: 2569045 3967691: 000100001111011111010101100100011000000000011011010110001001010100101011111001000111100000100000111111000000101110",
            "test_006: 2569046 3967724: 110101011111001000101011010110000001110110001111111010010111000000001010010111001111111011001000000001001000011101",
            "test_006: 1099602 1699146: 111110110111011000001010010011100000100100010000000111110111010010100011001100111001111010011111000100101111101010",
            "test_006: 1099603 1699179: 111110110111011000001010010011100000100100010000000111110111010010100011001100111001111010011111000100101111101010",
            "test_006: 1099604 1699212: 111110110111011000001010010011100000100100010000000111110111010010100011001100111001111010011111000100101111101010",
            "test_006: 1099605 1699245: 111110110111011000001010010011100000100100010000000111110111010010100011001100111001111010011111000100101111101010"
        ]
        
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        printer = grgsm.bursts_printer(pmt.intern("test_006: "), True, True, True, False)
        self.tb.msg_connect(src, "out", printer, "bursts")
        self.tb.run()

        self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines))
Пример #17
0
    def test_002_sdcch4(self):

        bursts_expected_0 = [
            '0000100100010010111100111000011000001100100001110101110011011001011011101111000100101111001011000000010111001011110011000000001101100001001000100000',
            '0001010000110010100010110111101111100100000011111000000010111010011101011000001001110101111100000011101010001010100001101000011010110000001001111000',
            '0001101101111011000010001000000010001110101111001111111111110001011011101111000100101110110001011010110110100111000000010010101110111001111011000000',
            '0001101000100010100001101100100101011100111000001101001010100010011101011000001001110100011100101100000010110101011011100111111011111101100000011000',
            '0000100101010011010110101001100100110001011010111110110100011101001111101100010100111110111000110110100011001010110011000111011111110011001011100000',
            '0001000110100001111010110101011111001000011100001111010110001001011011101111000100101111100001011001100110011001110101100001000001011011111110100000',
            '0001011010100110001000100000001110010000011000111001001110000001001011100001000100101110011011011001000111101010001010111001101100000100001101001000',
            '0000001010000101101010000000110000010101111011100110101000110111011110001001011101111001100011100100100100100000010010001111101111110011000001011000',
            '0000001000011111101111110000000000001100011111011010111010000111011110001001011101111001001100000001010100111111011000000110010111101001110010011000',
            '0000100000011100011111001001001000001000100010010111101011101010011101011000001001110100000000010010011001110100101111001110111111010000010001000000',
            '0001000101001011001111111101010111110010010110111111110000010001011011101111000100101111000100010000111110011101000001111100001001100100011100011000',
            '0001101101101010110000001001110111001001000001110110110000110001001011100001000100101111100001110001000000110101100001111111001001111001101101100000',
        ]

        bursts_expected_1 = [
            '0001010110101101110000011111101100001000001001110101100000011010001111011010001000111100000100110001111110110111010101011011011100111000101111010000',
            '0000010000111000010001010010111110000100011000000101110110001000110101110010000011010111001100010011100001111101000101011110100001100010010110001000',
            '0000011110101100001001101000001010010100100111101101101000110101001111101100010100111111011001110000011000100001010011100000001100010110101001001000',
            '0001110111101011100000001011111101100110110001001100101111110010000111011101001000011101110010001111000010011110001101101111101011100001001100100000',
            '0000000111000111010110000000001001101110001001001101100110010001011011101111000100101111101011111100101001110100101000011100111001001101101011101000',
            '0000100100010111010011100110101011011010001011011011011101110010001111011010001000111100000110010111001010011100000011111100111000100100101010110000',
            '0000101111000000100110100001011000000011111111010101010011011010000111011101001000011101110010101101000100100000001100001000100111001010010000111000',
            '0000001001001101110111111011010011000011100001100011110011010001001011100001000100101110011100000010010111101100101011011111101011000000001100101000',
            '0000110011100000100000000010100100011001001000110010110101111001001011100001000100101110000111001100111111110011011001000001001000001111001101001000',
            '0001001111100001110110001010100011100011110011100001010100001001001011100001000100101111001000101100111101001010111000010111101000000001101100101000',
            '0000101001000010000001100001000011001010100011110111101110111001001011100001000100101110001010100101111010111000000010111011000010011001101000001000',
            '0001101000000100110100110001010111010111111001101110110101100111011110001001011101111001000110010011100100000100011101110110111010001001000111101000',
        ]

        bursts_expected_2 = [
            '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000',
            '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000',
            '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000',
            '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000',
            '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000',
            '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000',
            '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000',
            '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000',
            '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000',
            '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000',
            '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000',
            '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000',
        ]

        bursts_expected_3 = [
            '0001011010100110110011000101111111010011110001101000011100101000110101110010000011010110110100000111011101000001101010100001110111001011010101111000',
            '0000101010001100010011010101011110010101101110011110100110001010001111011010001000111100000010011011100001010001001111111100011111000011001010011000',
            '0000111001011100101100111001010101000101010111011110111101010001001011100001000100101111100010100101111011000101100000101111000101011110011111100000',
            '0000010101101111011001100001011100100101001000110111010110001111011110001001011101111000011010010010101111010000110000011001101011100000111110000000',
            '0000001010101101011001000000001000001001110100000111000000101001001011100001000100101110111111011101110101010011001110111111101001011010110000101000',
            '0001011110101111110100110010010110011100111010011001001110011111011110001001011101111000101010001111000111000101111000100011100010100010010100010000',
            '0001000001011110010010100001100010111111000111001111010101011111011110001001011101111001010010100101110110111111001111110010111100111010110011110000',
            '0001111100100010101100010111000000011011001111001101101001000010001111011010001000111101111000000101111001110101101001101010001110100111101011001000',
            '0000100101100011001010101100011110000111001110010010010000100001011011101111000100101110001111010000001000001101011010110101010111011011001101101000',
            '0000110000111101100001011100100011101011011000111100001000000111011110001001011101111000111000000111100100101000000101100011011001111100110011110000',
            '0000011001111001100111110110110000001111110101011110100011010010011101011000001001110101001101110111111100001001000101101101100110001111101011010000',
            '0000100001011010001010000101110000111100011110110010000010101000110101110010000011010111010001010101111111111101101100110101111010110100001110101000',
        ]

        src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input,
                                 self.bursts_input)
        splitter = grgsm.burst_sdcch_subslot_splitter(grgsm.SPLITTER_SDCCH4)
        sink_0 = grgsm.burst_sink()
        sink_1 = grgsm.burst_sink()
        sink_2 = grgsm.burst_sink()
        sink_3 = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", splitter, "in")
        self.tb.msg_connect(splitter, "out0", sink_0, "in")
        self.tb.msg_connect(splitter, "out1", sink_1, "in")
        self.tb.msg_connect(splitter, "out2", sink_2, "in")
        self.tb.msg_connect(splitter, "out3", sink_3, "in")

        self.tb.run()

        bursts_result_0 = list(sink_0.get_burst_data())
        bursts_result_1 = list(sink_1.get_burst_data())
        bursts_result_2 = list(sink_2.get_burst_data())
        bursts_result_3 = list(sink_3.get_burst_data())

        self.assertEqual(bursts_expected_0, bursts_result_0)
        self.assertEqual(bursts_expected_1, bursts_result_1)
        self.assertEqual(bursts_expected_2, bursts_result_2)
        self.assertEqual(bursts_expected_3, bursts_result_3)
Пример #18
0
    def test_001 (self):
        """
            24 random framenumbers, timeslots and bursts as input
        """
        framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270]
        timeslots_input = [6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7]
        bursts_input = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
            "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
            "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
            "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
            "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
            "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000"
        ]

        bursts_expected_0 = [
            "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000"
        ]
        
        bursts_expected_1 = [
            "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000"
        ]
        
        bursts_expected_2 = [
            "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000"
        ]
        
        bursts_expected_3 = [
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000"
        ]
        
        bursts_expected_4 = [
            "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000"
        ]
        
        bursts_expected_5 = [
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000"
        ]
        
        bursts_expected_6 = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
            "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
            "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000"
        ]
        
        bursts_expected_7 = [
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000"
        ]


        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        splitter = grgsm.burst_timeslot_splitter()
        sink_0 = grgsm.burst_sink()
        sink_1 = grgsm.burst_sink()
        sink_2 = grgsm.burst_sink()
        sink_3 = grgsm.burst_sink()
        sink_4 = grgsm.burst_sink()
        sink_5 = grgsm.burst_sink()
        sink_6 = grgsm.burst_sink()
        sink_7 = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", splitter, "in")
        self.tb.msg_connect(splitter, "out0", sink_0, "in")
        self.tb.msg_connect(splitter, "out1", sink_1, "in")
        self.tb.msg_connect(splitter, "out2", sink_2, "in")
        self.tb.msg_connect(splitter, "out3", sink_3, "in")
        self.tb.msg_connect(splitter, "out4", sink_4, "in")
        self.tb.msg_connect(splitter, "out5", sink_5, "in")
        self.tb.msg_connect(splitter, "out6", sink_6, "in")
        self.tb.msg_connect(splitter, "out7", sink_7, "in")

        self.tb.run ()

        bursts_result_0 = list(sink_0.get_burst_data())
        bursts_result_1 = list(sink_1.get_burst_data())
        bursts_result_2 = list(sink_2.get_burst_data())
        bursts_result_3 = list(sink_3.get_burst_data())
        bursts_result_4 = list(sink_4.get_burst_data())
        bursts_result_5 = list(sink_5.get_burst_data())
        bursts_result_6 = list(sink_6.get_burst_data())
        bursts_result_7 = list(sink_7.get_burst_data())
        
        self.assertEqual(bursts_expected_0, bursts_result_0)
        self.assertEqual(bursts_expected_1, bursts_result_1)
        self.assertEqual(bursts_expected_2, bursts_result_2)
        self.assertEqual(bursts_expected_3, bursts_result_3)
        self.assertEqual(bursts_expected_4, bursts_result_4)
        self.assertEqual(bursts_expected_5, bursts_result_5)
        self.assertEqual(bursts_expected_6, bursts_result_6)
        self.assertEqual(bursts_expected_7, bursts_result_7)
Пример #19
0
    def test_downlink (self):
        """
           SDCCH8 demapper downlink test
        """
        src = grgsm.burst_source(test_data.frames, test_data.timeslots, test_data.bursts)
        src.set_arfcn(0); # downlink
        demapper = grgsm.gsm_sdcch8_demapper(timeslot_nr=0)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", demapper, "bursts")
        self.tb.msg_connect(demapper, "bursts", dst, "in")
        self.tb.run ()

        b = test_data.bursts
        self.assertEqual([
            b[  0], b[  1], b[  2], b[  3], #SDCCH 0
            b[  4], b[  5], b[  6], b[  7], #SDCCH 1
            b[  8], b[  9], b[ 10], b[ 11], #SDCCH 2
            b[ 12], b[ 13], b[ 14], b[ 15], #SDCCH 3
            b[ 16], b[ 17], b[ 18], b[ 19], #SDCCH 4
            b[ 20], b[ 21], b[ 22], b[ 23], #SDCCH 5
            b[ 24], b[ 25], b[ 26], b[ 27], #SDCCH 6
            b[ 28], b[ 29], b[ 30], b[ 31], #SDCCH 7
            b[ 32], b[ 33], b[ 34], b[ 35], #SACCH 0
            b[ 36], b[ 37], b[ 38], b[ 39], #SACCH 1
            b[ 40], b[ 41], b[ 42], b[ 43], #SACCH 2
            b[ 44], b[ 45], b[ 46], b[ 47], #SACCH 3 #skip 48-50
            b[ 51], b[ 52], b[ 53], b[ 54], #SDCCH 0
            b[ 55], b[ 56], b[ 57], b[ 58], #SDCCH 1
            b[ 59], b[ 60], b[ 61], b[ 62], #SDCCH 2
            b[ 63], b[ 64], b[ 65], b[ 66], #SDCCH 3
            b[ 67], b[ 68], b[ 69], b[ 70], #SDCCH 4
            b[ 71], b[ 72], b[ 73], b[ 74], #SDCCH 5
            b[ 75], b[ 76], b[ 77], b[ 78], #SDCCH 6
            b[ 79], b[ 80], b[ 81], b[ 82], #SDCCH 7
            b[ 83], b[ 84], b[ 85], b[ 86], #SACCH 4
            b[ 87], b[ 88], b[ 89], b[ 90], #SACCH 5
            b[ 91], b[ 92], b[ 93], b[ 94], #SACCH 6
            b[ 95], b[ 96], b[ 97], b[ 98], #SACCH 7 #skip 99-101
            b[102], b[103], b[104], b[105], #SDCCH
            ], list(dst.get_burst_data()))

        self.assertEqual([
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
            136, 136, 136, 136,
            136, 136, 136, 136,
            136, 136, 136, 136,
            136, 136, 136, 136,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
              8,   8,   8,   8,
            136, 136, 136, 136,
            136, 136, 136, 136,
            136, 136, 136, 136,
            136, 136, 136, 136,
              8,   8,   8,   8,
            ], list(dst.get_sub_types()))

        self.assertEqual([
            0, 0, 0, 0,
            1, 1, 1, 1,
            2, 2, 2, 2,
            3, 3, 3, 3,
            4, 4, 4, 4,
            5, 5, 5, 5,
            6, 6, 6, 6,
            7, 7, 7, 7,
            0, 0, 0, 0, #SACCH 0
            1, 1, 1, 1, #SACCH 1
            2, 2, 2, 2, #SACCH 2
            3, 3, 3, 3, #SACCH 3
            0, 0, 0, 0,
            1, 1, 1, 1,
            2, 2, 2, 2,
            3, 3, 3, 3,
            4, 4, 4, 4,
            5, 5, 5, 5,
            6, 6, 6, 6,
            7, 7, 7, 7,
            4, 4, 4, 4, #SACCH 4
            5, 5, 5, 5, #SACCH 5
            6, 6, 6, 6, #SACCH 6
            7, 7, 7, 7, #SACCH 7
            0, 0, 0, 0,
            ], list(dst.get_sub_slots()))
    def test_001(self):
        """
            24 random framenumbers, timeslots and bursts as input
        """
        framenumbers_input = [
            1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588,
            1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397,
            1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339,
            551375, 1259270
        ]
        timeslots_input = [
            6, 1, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 1, 2, 0, 7, 1, 0, 6, 0, 6,
            5, 7
        ]
        bursts_input = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
            "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
            "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
            "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
            "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
            "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000"
        ]

        bursts_expected = [
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000"
        ]

        timeslot = 1
        src = grgsm.burst_source(framenumbers_input, timeslots_input,
                                 bursts_input)
        ts_filter = grgsm.burst_timeslot_filter(timeslot)
        sink = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", ts_filter, "in")
        self.tb.msg_connect(ts_filter, "out", sink, "in")

        self.tb.run()

        bursts_result = list(sink.get_burst_data())

        self.assertEqual(bursts_expected, bursts_result)
    def test_downlink(self):
        """
           BCCH_CCCH_SDCCH4 demapper downlink test
        """
        src = grgsm.burst_source(test_data.frames, test_data.timeslots,
                                 test_data.bursts)
        src.set_arfcn(0)
        # downlink
        demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper(timeslot_nr=0)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", demapper, "bursts")
        self.tb.msg_connect(demapper, "bursts", dst, "in")
        self.tb.run()

        b = test_data.bursts
        self.assertEqual(
            [
                b[2],
                b[3],
                b[4],
                b[5],  #BCCH
                b[6],
                b[7],
                b[8],
                b[9],  #CCCH    skip 2
                b[12],
                b[13],
                b[14],
                b[15],  #CCCH
                b[16],
                b[17],
                b[18],
                b[19],  #CCCH    skip 2
                b[22],
                b[23],
                b[24],
                b[25],  #SDCCH 0
                b[26],
                b[27],
                b[28],
                b[29],  #SDCCH 1 skip 2
                b[32],
                b[33],
                b[34],
                b[35],  #SDCCH 2
                b[36],
                b[37],
                b[38],
                b[39],  #SDCCH 3 skip 2
                b[42],
                b[43],
                b[44],
                b[45],  #SACCH 0
                b[46],
                b[47],
                b[48],
                b[49],  #SACCH 1 skip 3
                b[53],
                b[54],
                b[55],
                b[56],  #BCCH
                b[57],
                b[58],
                b[59],
                b[60],  #CCCH    skip 2
                b[63],
                b[64],
                b[65],
                b[66],  #CCCH
                b[67],
                b[68],
                b[69],
                b[70],  #CCCH    skip 2
                b[73],
                b[74],
                b[75],
                b[76],  #SDCCH 0
                b[77],
                b[78],
                b[79],
                b[80],  #SDCCH 1 skip 2
                b[83],
                b[84],
                b[85],
                b[86],  #SDCCH 2
                b[87],
                b[88],
                b[89],
                b[90],  #SDCCH 3 skip 2
                b[93],
                b[94],
                b[95],
                b[96],  #SACCH 1
                b[97],
                b[98],
                b[99],
                b[100],  #SACCH 2 skip 3
                b[104],
                b[105],
                b[106],
                b[107]  #BCCH
            ],
            list(dst.get_burst_data()))

        self.assertEqual(
            [
                1,
                1,
                1,
                1,  #BCCH
                2,
                2,
                2,
                2,  #CCCH
                2,
                2,
                2,
                2,  #CCCH
                2,
                2,
                2,
                2,  #CCCH
                7,
                7,
                7,
                7,  #SDCCH 0
                7,
                7,
                7,
                7,  #SDCCH 1
                7,
                7,
                7,
                7,  #SDCCH 2
                7,
                7,
                7,
                7,  #SDCCH 3
                135,
                135,
                135,
                135,  #SACCH 0
                135,
                135,
                135,
                135,  #SACCH 1
                1,
                1,
                1,
                1,  #BCCH
                2,
                2,
                2,
                2,  #CCCH
                2,
                2,
                2,
                2,  #CCCH
                2,
                2,
                2,
                2,  #CCCH
                7,
                7,
                7,
                7,  #SDCCH 0
                7,
                7,
                7,
                7,  #SDCCH 1
                7,
                7,
                7,
                7,  #SDCCH 2
                7,
                7,
                7,
                7,  #SDCCH 3
                135,
                135,
                135,
                135,  #SACCH 2
                135,
                135,
                135,
                135,  #SACCH 3
                1,
                1,
                1,
                1,  #BCCH
            ],
            list(dst.get_sub_types()))

        self.assertEqual(
            [
                0,
                0,
                0,
                0,  #BCCH
                0,
                0,
                0,
                0,  #CCCH
                1,
                1,
                1,
                1,  #CCCH
                2,
                2,
                2,
                2,  #CCCH
                0,
                0,
                0,
                0,  #SDCCH 0
                1,
                1,
                1,
                1,  #SDCCH 1
                2,
                2,
                2,
                2,  #SDCCH 2
                3,
                3,
                3,
                3,  #SDCCH 3
                0,
                0,
                0,
                0,  #SACCH 0
                1,
                1,
                1,
                1,  #SACCH 1
                0,
                0,
                0,
                0,  #BCCH
                0,
                0,
                0,
                0,  #CCCH
                1,
                1,
                1,
                1,  #CCCH
                2,
                2,
                2,
                2,  #CCCH
                0,
                0,
                0,
                0,  #SDCCH 0
                1,
                1,
                1,
                1,  #SDCCH 1
                2,
                2,
                2,
                2,  #SDCCH 2
                3,
                3,
                3,
                3,  #SDCCH 3
                2,
                2,
                2,
                2,  #SACCH 2
                3,
                3,
                3,
                3,  #SACCH 3
                0,
                0,
                0,
                0,  #BCCH
            ],
            list(dst.get_sub_slots()))
    def test_uplink(self):
        """
           BCCH_CCCH_SDCCH4 demapper uplink test
        """
        src = grgsm.burst_source(test_data.frames, test_data.timeslots,
                                 test_data.bursts)
        src.set_arfcn(0x2240)
        #uplink flag is 40
        demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper(timeslot_nr=0)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", demapper, "bursts")
        self.tb.msg_connect(demapper, "bursts", dst, "in")
        self.tb.run()

        b = test_data.bursts
        self.assertEqual(b, list(dst.get_burst_data()))

        self.assertEqual(
            [
                7,
                7,
                7,
                7,  #SDCCH 3
                3,
                3,  #RACCH
                135,
                135,
                135,
                135,  #SACCH 2
                135,
                135,
                135,
                135,  #SACCH 3
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,  #RACCH
                7,
                7,
                7,
                7,  #SDCCH 0
                7,
                7,
                7,
                7,  #SDCCH 1
                3,
                3,  #RACCH
                7,
                7,
                7,
                7,  #SDCCH 2
                7,
                7,
                7,
                7,  #SDCCH 3
                3,
                3,  #RACCH
                135,
                135,
                135,
                135,  #SACCH 0
                135,
                135,
                135,
                135,  #SACCH 1
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,
                3,  #RACCH
                3,
                3,
                3,  #RACCH
                7,
                7,
                7,
                7,  #SDCCH 0
                7,
                7,
                7,
                7,  #SDCCH 1
                3,
                3,  #RACCH
                7,
                7,
                7,
                7,  #SDCCH 2
                7,
                7,
                7,
                7,  #SDCCH 3
                3,
                3,  #RACCH
            ],
            list(dst.get_sub_types()))

        self.assertEqual(
            [
                3,
                3,
                3,
                3,  #SDCCH 3
                0,
                0,  #RACCH
                2,
                2,
                2,
                2,  #SACCH 2
                3,
                3,
                3,
                3,  #SACCH 3
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #SDCCH 0
                1,
                1,
                1,
                1,  #SDCCH 1
                0,
                0,  #RACCH
                2,
                2,
                2,
                2,  #SDCCH 2
                3,
                3,
                3,
                3,  #SDCCH 3
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #SACCH 0
                1,
                1,
                1,
                1,  #SACCH 1
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,  #RACCH
                0,
                0,
                0,
                0,  #SDCCH 0
                1,
                1,
                1,
                1,  #SDCCH 1
                0,
                0,  #RACCH
                2,
                2,
                2,
                2,  #SDCCH 2
                3,
                3,
                3,
                3,  #SDCCH 3
                0,
                0,  #RACCH
            ],
            list(dst.get_sub_slots()))
    def test_001_sdcch8 (self):

        bursts_expected_0 = [
            '0000111100101011111011010010011001000100001001110110000110110001011011101111000100101111111000110000001111111111000111100100011111010100010011111000',
            '0001111110000000110110101010001000101000001101111100101100110010001111011010001000111100001010011101000111010111000100000111001111110011000011011000',
            '0001101110111011011011011010000001011011001011000100100110010101001111101100010100111110110011001100100011111010110111011001000111101011100001111000',
            '0000001011100110100011110111010101111000011111001011010011110000110101110010000011010110010011111001000110001111111010111011011001101010001100110000',
            '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000',
            '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000',
            '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000',
            '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000',
            '0000100010110111011001100110110010101011011110101001010001000001011011101111000100101111010101100010101110101111111011101000010111001111000101001000',
            '0001110000101111100101001101001111101011000000011011000101111000110101110010000011010111111100111011111000000001010111001100110100100011010000011000',
            '0000011000101001110100000000110101011101011010001101110110111001011011101111000100101111110110101011110110100111000000000011110011101000011000001000',
            '0000101001000100101010001110110111010000011011001011101010010111011110001001011101111001111010110101100100101001111000100000010001000110000000110000',
        ]
        
        bursts_expected_1 = [
            '0001011001110011011101111111100110110111011101001110111110000101001111101100010100111110001111100000000110001000010000010111111011110101100000111000',
            '0001110110011011010011100010101010000100011000001111110101111101001111101100010100111110100001001101000100000001011001010110011111100010001111001000',
            '0001101100101101011110011001110110011100001100100100100110000010001111011010001000111101101101001100100001110001011001000001100000011111101000011000',
            '0000101100001011101001010001111001000000010100000111100110101000110101110010000011010110110000110010100011001111101101101001110111101001000011111000',
            '0001011010100110110011000101111111010011110001101000011100101000110101110010000011010110110100000111011101000001101010100001110111001011010101111000',
            '0000101010001100010011010101011110010101101110011110100110001010001111011010001000111100000010011011100001010001001111111100011111000011001010011000',
            '0000111001011100101100111001010101000101010111011110111101010001001011100001000100101111100010100101111011000101100000101111000101011110011111100000',
            '0000010101101111011001100001011100100101001000110111010110001111011110001001011101111000011010010010101111010000110000011001101011100000111110000000',
            '0000000111100101111111000110011101000110010110001110100101110001011011101111000100101110100010010011100010010001110100010101101101100111100110101000',
            '0001000011111010000000011010011001010010011111000011110111010010001111011010001000111101101110111000011010001010100111011000001000110000101000000000',
            '0001101000110010011001001110101101111110000111001101100110011001001011100001000100101110000101000111011001110001100011011101101000101001001001101000',
            '0001100111010000101101001110010001001001011000011000001011001010011101011000001001110101101110110101111101110010010010000001000100011111010100011000',
        ]
        
        bursts_expected_2 = [
            '0000011011010111011111101100010100110110000001100011100001010001011011101111000100101110001110000011001100100101111000001010000101010000110101110000',
            '0000111100110111001011010100010010110100101010000000010001110010011101011000001001110100001010011111111111001010111010111010001111111101111110101000',
            '0000111101101110011111010100010100110001101110001001111100100101001111101100010100111111100010010001001100000000111010001000100011010000110111110000',
            '0000011100010011111011011001110010011000001111111110101000100000110101110010000011010111101011000100101011000011011011110000010001100110011010001000',
            '0001000001011000010001000100100111110011001101111100010011110010011101011000001001110100110100101101100011010111101110110010101101001110001101010000',
            '0000101000011101110011111001010011111001001010010000101110010001011011101111000100101111011111110000000100000110011001000100110000111001100000011000',
            '0000100101010011010110101001100100110001011010111110110100011101001111101100010100111110111000110110100011001010110011000111011111110011001011100000',
            '0001000110100001111010110101011111001000011100001111010110001001011011101111000100101111100001011001100110011001110101100001000001011011111110100000',
            '0001001101011001110000101110011110100001001000001111000100001001001011100001000100101110100010110100111010110010011000100111000100111111011000101000',
            '0001001101010000111101110111111011000100101011011001110001001010011101011000001001110101000000011110001101001010110001100011000110100010011010000000',
            '0000100100011000011010111010110001000101111010001001010110100001011011101111000100101111100001000101011111111110000011111111100110100100110000111000',
            '0001011101111100011001100110010001000101100001001001000010110001011011101111000100101110101100111111101111111001110110100101000011100110000001011000',

        ]
        
        bursts_expected_3 = [
            '0000011011100100011101000010111010101101001111110000110001111010000111011101001000011101111110101010000011100100111101000111101110011011001001100000',
            '0000110100110111001010100011100010101001001010011001001111001001001011100001000100101111001001100100001111100111000101110111100011101100110100010000',
            '0000011101101000110111010010111001011110101000001011111000101010000111011101001000011100100100010110101110101010001000011001001110100001000101001000',
            '0000101000110000011100111010101000001101000111111101100100110010011101011000001001110101001101110101011110010100101010001110100001100010101000001000',
            '0001011010100110001000100000001110010000011000111001001110000001001011100001000100101110011011011001000111101010001010111001101100000100001101001000',
            '0000001010000101101010000000110000010101111011100110101000110111011110001001011101111001100011100100100100100000010010001111101111110011000001011000',
            '0000000111000111010110000000001001101110001001001101100110010001011011101111000100101111101011111100101001110100101000011100111001001101101011101000',
            '0000100100010111010011100110101011011010001011011011011101110010001111011010001000111100000110010111001010011100000011111100111000100100101010110000',
            '0001101000100100101011000001001101111011100110101010001110100010000111011101001000011101101101011111110001110001010000001111100110111101101000100000',
            '0000010101011110000000010011100010101011101111011001100111001010001111011010001000111100010001101011101000101100010110100100001101010110010111000000',
            '0001100011011000111011100010111111000000011111101010000010110001011011101111000100101111010100100110010000001010100011100001111011110010001011001000',
            '0001001011000011010010000001001110110110010101010011000101001000110101110010000011010111010010011000110011000110000101111000010100001000011111111000',
        ]
        
        bursts_expected_4 = [
            '0000100010110110000111101001011000001010011110000100111101111010011101011000001001110101100010000111010100001000110001110001111101010100100101010000',
            '0000010110111011011100011101010001001011001110100011100001000101001111101100010100111110100100110001110011001011110001100000000100100111000011111000',
            '0001101110100101110101100101011101111100111010101011110001101010000111011101001000011100100010100111110110111001001000100111110111100100010010111000',
            '0000111000101011011101110110001110101111100010100000110111110010000111011101001000011101111011000101010100011111001000010000110101101110000010101000',
            '0000010100100110100110001010001011011000110000101011000001110001001011100001000100101111101010000111110111011010101010001100101100010100001000010000',
            '0001101100111011110100000010111000000110111101001110111110111010011101011000001001110101011110110010010011001011001110101001101010101001011000010000',
            '0001100011110111001100101110010110000110101101101111101101111001011011101111000100101111110001100010010000011100010000011011100010100111101001110000',
            '0001010011010010101001001000100111111010011101011001110110010001011011101111000100101111111010111010010001100100101100011000100110011001101101000000',
            '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000',
            '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000',
            '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000',
            '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000',        
        ]
        
        bursts_expected_5 = [
            '0001001010011001111011001110100001000110010111110011111001000010011101011000001001110100001101000101010010001101001010111100100101010101011100110000',
            '0000100010001111101111100100010010100000010111001011101101001000110101110010000011010110110011100111001001100101011010100101110011100001110010001000',
            '0000100100010010111100111000011000001100100001110101110011011001011011101111000100101111001011000000010111001011110011000000001101100001001000100000',
            '0001010000110010100010110111101111100100000011111000000010111010011101011000001001110101111100000011101010001010100001101000011010110000001001111000',
            '0000111011001001001100100100100101011111011100110101011100010010011101011000001001110101010100111100111001000001100010100111100001010011111111111000',
            '0001100101110101101110111111000100110000001111010000100001011101001111101100010100111110111111110111000010011100101001111011010100001010001010001000',
            '0000001000011111101111110000000000001100011111011010111010000111011110001001011101111001001100000001010100111111011000000110010111101001110010011000',
            '0000100000011100011111001001001000001000100010010111101011101010011101011000001001110100000000010010011001110100101111001110111111010000010001000000',
            '0000001010101101011001000000001000001001110100000111000000101001001011100001000100101110111111011101110101010011001110111111101001011010110000101000',
            '0001011110101111110100110010010110011100111010011001001110011111011110001001011101111000101010001111000111000101111000100011100010100010010100010000',
            '0001000001011110010010100001100010111111000111001111010101011111011110001001011101111001010010100101110110111111001111110010111100111010110011110000',
            '0001111100100010101100010111000000011011001111001101101001000010001111011010001000111101111000000101111001110101101001101010001110100111101011001000',
        ]
        
        bursts_expected_6 = [
            '0001101101111011000010001000000010001110101111001111111111110001011011101111000100101110110001011010110110100111000000010010101110111001111011000000',
            '0001101000100010100001101100100101011100111000001101001010100010011101011000001001110100011100101100000010110101011011100111111011111101100000011000',
            '0001010110101101110000011111101100001000001001110101100000011010001111011010001000111100000100110001111110110111010101011011011100111000101111010000',
            '0000010000111000010001010010111110000100011000000101110110001000110101110010000011010111001100010011100001111101000101011110100001100010010110001000',
            '0001000101001011001111111101010111110010010110111111110000010001011011101111000100101111000100010000111110011101000001111100001001100100011100011000',
            '0001101101101010110000001001110111001001000001110110110000110001001011100001000100101111100001110001000000110101100001111111001001111001101101100000',
            '0000110011100000100000000010100100011001001000110010110101111001001011100001000100101110000111001100111111110011011001000001001000001111001101001000',
            '0001001111100001110110001010100011100011110011100001010100001001001011100001000100101111001000101100111101001010111000010111101000000001101100101000',
            '0000000011001001101001100111101011001011000100101100101001100010001111011010001000111101100100101001010100111000010001011000100110010101010111000000',
            '0001111000011111011100011010110000000010000000100000111000100010011101011000001001110100011101011101001001000111011101100001011010101000011011011000',
            '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000',
            '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000',
        ]
        
        bursts_expected_7 = [
            '0000011110101100001001101000001010010100100111101101101000110101001111101100010100111111011001110000011000100001010011100000001100010110101001001000',
            '0001110111101011100000001011111101100110110001001100101111110010000111011101001000011101110010001111000010011110001101101111101011100001001100100000',
            '0001111110100011001100101111001001101000101110011100011000100001001011100001000100101110000110110010111111110101000110001011010110011010100011001000',
            '0001011100010110000001011011001100000101010000011010001000111111011110001001011101111001101111000011111110011001000010000011000101100011111001010000',
            '0000101001000010000001100001000011001010100011110111101110111001001011100001000100101110001010100101111010111000000010111011000010011001101000001000',
            '0001101000000100110100110001010111010111111001101110110101100111011110001001011101111001000110010011100100000100011101110110111010001001000111101000',
            '0000100000100110011100101001110010011011100010101101111001110010001111011010001000111101100000111011110010010111001100100010000101111111011101110000',
            '0000100111111010101000001110100011010010010010100001011010110000110101110010000011010110011000111000111111000100001010010000011011001000011100110000',
            '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000',
            '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000',
            '0000100101100011001010101100011110000111001110010010010000100001011011101111000100101110001111010000001000001101011010110101010111011011001101101000',
            '0000110000111101100001011100100011101011011000111100001000000111011110001001011101111000111000000111100100101000000101100011011001111100110011110000',
        ]

        src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input, self.bursts_input)
        splitter = grgsm.burst_sdcch_subslot_splitter(grgsm.SPLITTER_SDCCH8)
        sink_0 = grgsm.burst_sink()
        sink_1 = grgsm.burst_sink()
        sink_2 = grgsm.burst_sink()
        sink_3 = grgsm.burst_sink()
        sink_4 = grgsm.burst_sink()
        sink_5 = grgsm.burst_sink()
        sink_6 = grgsm.burst_sink()
        sink_7 = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", splitter, "in")
        self.tb.msg_connect(splitter, "out0", sink_0, "in")
        self.tb.msg_connect(splitter, "out1", sink_1, "in")
        self.tb.msg_connect(splitter, "out2", sink_2, "in")
        self.tb.msg_connect(splitter, "out3", sink_3, "in")
        self.tb.msg_connect(splitter, "out4", sink_4, "in")
        self.tb.msg_connect(splitter, "out5", sink_5, "in")
        self.tb.msg_connect(splitter, "out6", sink_6, "in")
        self.tb.msg_connect(splitter, "out7", sink_7, "in")

        self.tb.run ()

        bursts_result_0 = list(sink_0.get_burst_data())
        bursts_result_1 = list(sink_1.get_burst_data())
        bursts_result_2 = list(sink_2.get_burst_data())
        bursts_result_3 = list(sink_3.get_burst_data())
        bursts_result_4 = list(sink_4.get_burst_data())
        bursts_result_5 = list(sink_5.get_burst_data())
        bursts_result_6 = list(sink_6.get_burst_data())
        bursts_result_7 = list(sink_7.get_burst_data())
                
        self.assertEqual(bursts_expected_0, bursts_result_0)
        self.assertEqual(bursts_expected_1, bursts_result_1)
        self.assertEqual(bursts_expected_2, bursts_result_2)
        self.assertEqual(bursts_expected_3, bursts_result_3)
        self.assertEqual(bursts_expected_4, bursts_result_4)
        self.assertEqual(bursts_expected_5, bursts_result_5)
        self.assertEqual(bursts_expected_6, bursts_result_6)
        self.assertEqual(bursts_expected_7, bursts_result_7)
    def test_002_sdcch4 (self):

        bursts_expected_0 = [
            '0000100100010010111100111000011000001100100001110101110011011001011011101111000100101111001011000000010111001011110011000000001101100001001000100000',
            '0001010000110010100010110111101111100100000011111000000010111010011101011000001001110101111100000011101010001010100001101000011010110000001001111000',
            '0001101101111011000010001000000010001110101111001111111111110001011011101111000100101110110001011010110110100111000000010010101110111001111011000000',
            '0001101000100010100001101100100101011100111000001101001010100010011101011000001001110100011100101100000010110101011011100111111011111101100000011000',
            '0000100101010011010110101001100100110001011010111110110100011101001111101100010100111110111000110110100011001010110011000111011111110011001011100000',
            '0001000110100001111010110101011111001000011100001111010110001001011011101111000100101111100001011001100110011001110101100001000001011011111110100000',
            '0001011010100110001000100000001110010000011000111001001110000001001011100001000100101110011011011001000111101010001010111001101100000100001101001000',
            '0000001010000101101010000000110000010101111011100110101000110111011110001001011101111001100011100100100100100000010010001111101111110011000001011000',
            '0000001000011111101111110000000000001100011111011010111010000111011110001001011101111001001100000001010100111111011000000110010111101001110010011000',
            '0000100000011100011111001001001000001000100010010111101011101010011101011000001001110100000000010010011001110100101111001110111111010000010001000000',
            '0001000101001011001111111101010111110010010110111111110000010001011011101111000100101111000100010000111110011101000001111100001001100100011100011000',
            '0001101101101010110000001001110111001001000001110110110000110001001011100001000100101111100001110001000000110101100001111111001001111001101101100000',
        ]
        
        bursts_expected_1 = [
            '0001010110101101110000011111101100001000001001110101100000011010001111011010001000111100000100110001111110110111010101011011011100111000101111010000',
            '0000010000111000010001010010111110000100011000000101110110001000110101110010000011010111001100010011100001111101000101011110100001100010010110001000',
            '0000011110101100001001101000001010010100100111101101101000110101001111101100010100111111011001110000011000100001010011100000001100010110101001001000',
            '0001110111101011100000001011111101100110110001001100101111110010000111011101001000011101110010001111000010011110001101101111101011100001001100100000',
            '0000000111000111010110000000001001101110001001001101100110010001011011101111000100101111101011111100101001110100101000011100111001001101101011101000',
            '0000100100010111010011100110101011011010001011011011011101110010001111011010001000111100000110010111001010011100000011111100111000100100101010110000',
            '0000101111000000100110100001011000000011111111010101010011011010000111011101001000011101110010101101000100100000001100001000100111001010010000111000',
            '0000001001001101110111111011010011000011100001100011110011010001001011100001000100101110011100000010010111101100101011011111101011000000001100101000',
            '0000110011100000100000000010100100011001001000110010110101111001001011100001000100101110000111001100111111110011011001000001001000001111001101001000',
            '0001001111100001110110001010100011100011110011100001010100001001001011100001000100101111001000101100111101001010111000010111101000000001101100101000',
            '0000101001000010000001100001000011001010100011110111101110111001001011100001000100101110001010100101111010111000000010111011000010011001101000001000',
            '0001101000000100110100110001010111010111111001101110110101100111011110001001011101111001000110010011100100000100011101110110111010001001000111101000',
        ]
        
        bursts_expected_2 = [
            '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000',
            '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000',
            '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000',
            '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000',
            '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000',
            '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000',
            '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000',
            '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000',
            '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000',
            '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000',
            '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000',
            '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000',
        ]
        
        bursts_expected_3 = [
            '0001011010100110110011000101111111010011110001101000011100101000110101110010000011010110110100000111011101000001101010100001110111001011010101111000',
            '0000101010001100010011010101011110010101101110011110100110001010001111011010001000111100000010011011100001010001001111111100011111000011001010011000',
            '0000111001011100101100111001010101000101010111011110111101010001001011100001000100101111100010100101111011000101100000101111000101011110011111100000',
            '0000010101101111011001100001011100100101001000110111010110001111011110001001011101111000011010010010101111010000110000011001101011100000111110000000',
            '0000001010101101011001000000001000001001110100000111000000101001001011100001000100101110111111011101110101010011001110111111101001011010110000101000',
            '0001011110101111110100110010010110011100111010011001001110011111011110001001011101111000101010001111000111000101111000100011100010100010010100010000',
            '0001000001011110010010100001100010111111000111001111010101011111011110001001011101111001010010100101110110111111001111110010111100111010110011110000',
            '0001111100100010101100010111000000011011001111001101101001000010001111011010001000111101111000000101111001110101101001101010001110100111101011001000',
            '0000100101100011001010101100011110000111001110010010010000100001011011101111000100101110001111010000001000001101011010110101010111011011001101101000',
            '0000110000111101100001011100100011101011011000111100001000000111011110001001011101111000111000000111100100101000000101100011011001111100110011110000',
            '0000011001111001100111110110110000001111110101011110100011010010011101011000001001110101001101110111111100001001000101101101100110001111101011010000',
            '0000100001011010001010000101110000111100011110110010000010101000110101110010000011010111010001010101111111111101101100110101111010110100001110101000',
        ]
        
        src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input, self.bursts_input)
        splitter = grgsm.burst_sdcch_subslot_splitter(grgsm.SPLITTER_SDCCH4)
        sink_0 = grgsm.burst_sink()
        sink_1 = grgsm.burst_sink()
        sink_2 = grgsm.burst_sink()
        sink_3 = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", splitter, "in")
        self.tb.msg_connect(splitter, "out0", sink_0, "in")
        self.tb.msg_connect(splitter, "out1", sink_1, "in")
        self.tb.msg_connect(splitter, "out2", sink_2, "in")
        self.tb.msg_connect(splitter, "out3", sink_3, "in")

        self.tb.run ()

        bursts_result_0 = list(sink_0.get_burst_data())
        bursts_result_1 = list(sink_1.get_burst_data())
        bursts_result_2 = list(sink_2.get_burst_data())
        bursts_result_3 = list(sink_3.get_burst_data())
                
        self.assertEqual(bursts_expected_0, bursts_result_0)
        self.assertEqual(bursts_expected_1, bursts_result_1)
        self.assertEqual(bursts_expected_2, bursts_result_2)
        self.assertEqual(bursts_expected_3, bursts_result_3)
    def test_downlink(self):
        """
           BCCH_CCCH demapper downlink test
        """
        src = grgsm.burst_source(test_data.frames, test_data.timeslots,
                                 test_data.bursts)
        src.set_arfcn(0)
        # downlink
        demapper = grgsm.gsm_bcch_ccch_demapper(timeslot_nr=0)
        dst = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", demapper, "bursts")
        self.tb.msg_connect(demapper, "bursts", dst, "in")
        self.tb.run()

        b = test_data.bursts
        self.assertEqual(
            [
                b[2],
                b[3],
                b[4],
                b[5],  #BCCH
                b[6],
                b[7],
                b[8],
                b[9],  #CCCH skip 10-11
                b[12],
                b[13],
                b[14],
                b[15],
                b[16],
                b[17],
                b[18],
                b[19],  #skip 20-21
                b[22],
                b[23],
                b[24],
                b[25],
                b[26],
                b[27],
                b[28],
                b[29],  #skip 30-31
                b[32],
                b[33],
                b[34],
                b[35],
                b[36],
                b[37],
                b[38],
                b[39],  #skip 40-41
                b[42],
                b[43],
                b[44],
                b[45],
                b[46],
                b[47],
                b[48],
                b[49],  #skip 50-52
                b[53],
                b[54],
                b[55],
                b[56],  #BCCH
                b[57],
                b[58],
                b[59],
                b[60],  #CCCH skip 61-62
                b[63],
                b[64],
                b[65],
                b[66],
                b[67],
                b[68],
                b[69],
                b[70],  #skip 71-72
                b[73],
                b[74],
                b[75],
                b[76],
                b[77],
                b[78],
                b[79],
                b[80],  #skip 81-82
                b[83],
                b[84],
                b[85],
                b[86],
                b[87],
                b[88],
                b[89],
                b[90],  #skip 91-92
                b[93],
                b[94],
                b[95],
                b[96],
                b[97],
                b[98],
                b[99],
                b[100],  #skip 101-103
                b[104],
                b[105],
                b[106],
                b[107]  #BCCH
            ],
            list(dst.get_burst_data()))

        self.assertEqual(
            [
                1,
                1,
                1,
                1,  #BCCH
                2,
                2,
                2,
                2,  #CCCH
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                1,
                1,
                1,
                1,  #BCCH
                2,
                2,
                2,
                2,  #CCCH
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                2,
                1,
                1,
                1,
                1,  #BCCH
            ],
            list(dst.get_sub_types()))

        self.assertEqual(
            [
                0,
                0,
                0,
                0,  #BCCH
                0,
                0,
                0,
                0,  #CCCH 0
                1,
                1,
                1,
                1,
                2,
                2,
                2,
                2,
                3,
                3,
                3,
                3,
                4,
                4,
                4,
                4,
                5,
                5,
                5,
                5,
                6,
                6,
                6,
                6,
                7,
                7,
                7,
                7,
                8,
                8,
                8,
                8,  #CCCH 8
                0,
                0,
                0,
                0,  #BCCH
                0,
                0,
                0,
                0,  #CCCH 0
                1,
                1,
                1,
                1,
                2,
                2,
                2,
                2,
                3,
                3,
                3,
                3,
                4,
                4,
                4,
                4,
                5,
                5,
                5,
                5,
                6,
                6,
                6,
                6,
                7,
                7,
                7,
                7,
                8,
                8,
                8,
                8,  #CCCH 8
                0,
                0,
                0,
                0,  #BCCH
            ],
            list(dst.get_sub_slots()))
Пример #26
0
    def test_001(self):
        """
            24 random framenumbers, timeslots and bursts as input
        """
        framenumbers_input = [
            1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588,
            1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397,
            1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339,
            551375, 1259270
        ]
        timeslots_input = [
            6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6,
            5, 7
        ]
        bursts_input = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
            "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
            "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
            "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
            "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
            "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000"
        ]

        bursts_expected_0 = [
            "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000"
        ]

        bursts_expected_1 = [
            "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000"
        ]

        bursts_expected_2 = [
            "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000"
        ]

        bursts_expected_3 = [
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000"
        ]

        bursts_expected_4 = [
            "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000"
        ]

        bursts_expected_5 = [
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000"
        ]

        bursts_expected_6 = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
            "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
            "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000"
        ]

        bursts_expected_7 = [
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000"
        ]

        src = grgsm.burst_source(framenumbers_input, timeslots_input,
                                 bursts_input)
        splitter = grgsm.burst_timeslot_splitter()
        sink_0 = grgsm.burst_sink()
        sink_1 = grgsm.burst_sink()
        sink_2 = grgsm.burst_sink()
        sink_3 = grgsm.burst_sink()
        sink_4 = grgsm.burst_sink()
        sink_5 = grgsm.burst_sink()
        sink_6 = grgsm.burst_sink()
        sink_7 = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", splitter, "in")
        self.tb.msg_connect(splitter, "out0", sink_0, "in")
        self.tb.msg_connect(splitter, "out1", sink_1, "in")
        self.tb.msg_connect(splitter, "out2", sink_2, "in")
        self.tb.msg_connect(splitter, "out3", sink_3, "in")
        self.tb.msg_connect(splitter, "out4", sink_4, "in")
        self.tb.msg_connect(splitter, "out5", sink_5, "in")
        self.tb.msg_connect(splitter, "out6", sink_6, "in")
        self.tb.msg_connect(splitter, "out7", sink_7, "in")

        self.tb.run()

        bursts_result_0 = list(sink_0.get_burst_data())
        bursts_result_1 = list(sink_1.get_burst_data())
        bursts_result_2 = list(sink_2.get_burst_data())
        bursts_result_3 = list(sink_3.get_burst_data())
        bursts_result_4 = list(sink_4.get_burst_data())
        bursts_result_5 = list(sink_5.get_burst_data())
        bursts_result_6 = list(sink_6.get_burst_data())
        bursts_result_7 = list(sink_7.get_burst_data())

        self.assertEqual(bursts_expected_0, bursts_result_0)
        self.assertEqual(bursts_expected_1, bursts_result_1)
        self.assertEqual(bursts_expected_2, bursts_result_2)
        self.assertEqual(bursts_expected_3, bursts_result_3)
        self.assertEqual(bursts_expected_4, bursts_result_4)
        self.assertEqual(bursts_expected_5, bursts_result_5)
        self.assertEqual(bursts_expected_6, bursts_result_6)
        self.assertEqual(bursts_expected_7, bursts_result_7)
Пример #27
0
    def test_001(self):
        """
            filter mode less_or_equal, limiting frame number 1500123
            24 bursts as input, 10 of them dummy bursts
        """
        framenumbers_input = [
            1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588,
            1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397,
            1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339,
            551375, 1259270
        ]
        timeslots_input = [
            6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6,
            5, 7
        ]
        bursts_input = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000",
        ]

        bursts_expected = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000"
        ]

        dummy_burst_filter = grgsm.dummy_burst_filter()

        src = grgsm.burst_source(framenumbers_input, timeslots_input,
                                 bursts_input)
        sink = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", dummy_burst_filter, "in")
        self.tb.msg_connect(dummy_burst_filter, "out", sink, "in")

        self.tb.run()

        bursts_result = list(sink.get_burst_data())

        self.assertEqual(bursts_expected, bursts_result)
Пример #28
0
    def test_001 (self):
        """
            filter mode less_or_equal, limiting frame number 1500123
            24 bursts as input, 10 of them dummy bursts
        """
        framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270]
        timeslots_input = [6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7]
        bursts_input = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000",
        ]

        bursts_expected = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000"
        ]

        dummy_burst_filter = grgsm.dummy_burst_filter()
        
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        sink = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", dummy_burst_filter, "in")
        self.tb.msg_connect(dummy_burst_filter, "out", sink, "in")

        self.tb.run()

        bursts_result = list(sink.get_burst_data())
        
        self.assertEqual(bursts_expected, bursts_result)
Пример #29
0
    def test_002_greater_or_equal (self):
        """
            filter mode greater_or_equal, limiting frame number 1500123
            25 random framenumbers, timeslots and bursts as input
        """
        framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270, 1500123]
        timeslots_input = [6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7, 0]
        bursts_input = [
            "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
            "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
            "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
            "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
            "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
            "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
            "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
            "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
            "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
            "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
            "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
            "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
            "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
            "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000",
            "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
            "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000",
            "0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000"
        ]

        bursts_expected = [
            "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
            "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
            "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
            "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
            "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
            "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
            "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
            "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
            "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
            "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000",
            "0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000"
        ]

        fnr_filter = grgsm.burst_fnr_filter(grgsm.FILTER_GREATER_OR_EQUAL, 1500123)
        
        src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input)
        sink = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", fnr_filter, "in")
        self.tb.msg_connect(fnr_filter, "out", sink, "in")

        self.tb.run ()

        bursts_result = list(sink.get_burst_data())
        
        self.assertEqual(bursts_expected, bursts_result)
Пример #30
0
    def test_001_sdcch8(self):

        bursts_expected_0 = [
            '0000111100101011111011010010011001000100001001110110000110110001011011101111000100101111111000110000001111111111000111100100011111010100010011111000',
            '0001111110000000110110101010001000101000001101111100101100110010001111011010001000111100001010011101000111010111000100000111001111110011000011011000',
            '0001101110111011011011011010000001011011001011000100100110010101001111101100010100111110110011001100100011111010110111011001000111101011100001111000',
            '0000001011100110100011110111010101111000011111001011010011110000110101110010000011010110010011111001000110001111111010111011011001101010001100110000',
            '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000',
            '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000',
            '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000',
            '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000',
            '0000100010110111011001100110110010101011011110101001010001000001011011101111000100101111010101100010101110101111111011101000010111001111000101001000',
            '0001110000101111100101001101001111101011000000011011000101111000110101110010000011010111111100111011111000000001010111001100110100100011010000011000',
            '0000011000101001110100000000110101011101011010001101110110111001011011101111000100101111110110101011110110100111000000000011110011101000011000001000',
            '0000101001000100101010001110110111010000011011001011101010010111011110001001011101111001111010110101100100101001111000100000010001000110000000110000',
        ]

        bursts_expected_1 = [
            '0001011001110011011101111111100110110111011101001110111110000101001111101100010100111110001111100000000110001000010000010111111011110101100000111000',
            '0001110110011011010011100010101010000100011000001111110101111101001111101100010100111110100001001101000100000001011001010110011111100010001111001000',
            '0001101100101101011110011001110110011100001100100100100110000010001111011010001000111101101101001100100001110001011001000001100000011111101000011000',
            '0000101100001011101001010001111001000000010100000111100110101000110101110010000011010110110000110010100011001111101101101001110111101001000011111000',
            '0001011010100110110011000101111111010011110001101000011100101000110101110010000011010110110100000111011101000001101010100001110111001011010101111000',
            '0000101010001100010011010101011110010101101110011110100110001010001111011010001000111100000010011011100001010001001111111100011111000011001010011000',
            '0000111001011100101100111001010101000101010111011110111101010001001011100001000100101111100010100101111011000101100000101111000101011110011111100000',
            '0000010101101111011001100001011100100101001000110111010110001111011110001001011101111000011010010010101111010000110000011001101011100000111110000000',
            '0000000111100101111111000110011101000110010110001110100101110001011011101111000100101110100010010011100010010001110100010101101101100111100110101000',
            '0001000011111010000000011010011001010010011111000011110111010010001111011010001000111101101110111000011010001010100111011000001000110000101000000000',
            '0001101000110010011001001110101101111110000111001101100110011001001011100001000100101110000101000111011001110001100011011101101000101001001001101000',
            '0001100111010000101101001110010001001001011000011000001011001010011101011000001001110101101110110101111101110010010010000001000100011111010100011000',
        ]

        bursts_expected_2 = [
            '0000011011010111011111101100010100110110000001100011100001010001011011101111000100101110001110000011001100100101111000001010000101010000110101110000',
            '0000111100110111001011010100010010110100101010000000010001110010011101011000001001110100001010011111111111001010111010111010001111111101111110101000',
            '0000111101101110011111010100010100110001101110001001111100100101001111101100010100111111100010010001001100000000111010001000100011010000110111110000',
            '0000011100010011111011011001110010011000001111111110101000100000110101110010000011010111101011000100101011000011011011110000010001100110011010001000',
            '0001000001011000010001000100100111110011001101111100010011110010011101011000001001110100110100101101100011010111101110110010101101001110001101010000',
            '0000101000011101110011111001010011111001001010010000101110010001011011101111000100101111011111110000000100000110011001000100110000111001100000011000',
            '0000100101010011010110101001100100110001011010111110110100011101001111101100010100111110111000110110100011001010110011000111011111110011001011100000',
            '0001000110100001111010110101011111001000011100001111010110001001011011101111000100101111100001011001100110011001110101100001000001011011111110100000',
            '0001001101011001110000101110011110100001001000001111000100001001001011100001000100101110100010110100111010110010011000100111000100111111011000101000',
            '0001001101010000111101110111111011000100101011011001110001001010011101011000001001110101000000011110001101001010110001100011000110100010011010000000',
            '0000100100011000011010111010110001000101111010001001010110100001011011101111000100101111100001000101011111111110000011111111100110100100110000111000',
            '0001011101111100011001100110010001000101100001001001000010110001011011101111000100101110101100111111101111111001110110100101000011100110000001011000',
        ]

        bursts_expected_3 = [
            '0000011011100100011101000010111010101101001111110000110001111010000111011101001000011101111110101010000011100100111101000111101110011011001001100000',
            '0000110100110111001010100011100010101001001010011001001111001001001011100001000100101111001001100100001111100111000101110111100011101100110100010000',
            '0000011101101000110111010010111001011110101000001011111000101010000111011101001000011100100100010110101110101010001000011001001110100001000101001000',
            '0000101000110000011100111010101000001101000111111101100100110010011101011000001001110101001101110101011110010100101010001110100001100010101000001000',
            '0001011010100110001000100000001110010000011000111001001110000001001011100001000100101110011011011001000111101010001010111001101100000100001101001000',
            '0000001010000101101010000000110000010101111011100110101000110111011110001001011101111001100011100100100100100000010010001111101111110011000001011000',
            '0000000111000111010110000000001001101110001001001101100110010001011011101111000100101111101011111100101001110100101000011100111001001101101011101000',
            '0000100100010111010011100110101011011010001011011011011101110010001111011010001000111100000110010111001010011100000011111100111000100100101010110000',
            '0001101000100100101011000001001101111011100110101010001110100010000111011101001000011101101101011111110001110001010000001111100110111101101000100000',
            '0000010101011110000000010011100010101011101111011001100111001010001111011010001000111100010001101011101000101100010110100100001101010110010111000000',
            '0001100011011000111011100010111111000000011111101010000010110001011011101111000100101111010100100110010000001010100011100001111011110010001011001000',
            '0001001011000011010010000001001110110110010101010011000101001000110101110010000011010111010010011000110011000110000101111000010100001000011111111000',
        ]

        bursts_expected_4 = [
            '0000100010110110000111101001011000001010011110000100111101111010011101011000001001110101100010000111010100001000110001110001111101010100100101010000',
            '0000010110111011011100011101010001001011001110100011100001000101001111101100010100111110100100110001110011001011110001100000000100100111000011111000',
            '0001101110100101110101100101011101111100111010101011110001101010000111011101001000011100100010100111110110111001001000100111110111100100010010111000',
            '0000111000101011011101110110001110101111100010100000110111110010000111011101001000011101111011000101010100011111001000010000110101101110000010101000',
            '0000010100100110100110001010001011011000110000101011000001110001001011100001000100101111101010000111110111011010101010001100101100010100001000010000',
            '0001101100111011110100000010111000000110111101001110111110111010011101011000001001110101011110110010010011001011001110101001101010101001011000010000',
            '0001100011110111001100101110010110000110101101101111101101111001011011101111000100101111110001100010010000011100010000011011100010100111101001110000',
            '0001010011010010101001001000100111111010011101011001110110010001011011101111000100101111111010111010010001100100101100011000100110011001101101000000',
            '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000',
            '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000',
            '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000',
            '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000',
        ]

        bursts_expected_5 = [
            '0001001010011001111011001110100001000110010111110011111001000010011101011000001001110100001101000101010010001101001010111100100101010101011100110000',
            '0000100010001111101111100100010010100000010111001011101101001000110101110010000011010110110011100111001001100101011010100101110011100001110010001000',
            '0000100100010010111100111000011000001100100001110101110011011001011011101111000100101111001011000000010111001011110011000000001101100001001000100000',
            '0001010000110010100010110111101111100100000011111000000010111010011101011000001001110101111100000011101010001010100001101000011010110000001001111000',
            '0000111011001001001100100100100101011111011100110101011100010010011101011000001001110101010100111100111001000001100010100111100001010011111111111000',
            '0001100101110101101110111111000100110000001111010000100001011101001111101100010100111110111111110111000010011100101001111011010100001010001010001000',
            '0000001000011111101111110000000000001100011111011010111010000111011110001001011101111001001100000001010100111111011000000110010111101001110010011000',
            '0000100000011100011111001001001000001000100010010111101011101010011101011000001001110100000000010010011001110100101111001110111111010000010001000000',
            '0000001010101101011001000000001000001001110100000111000000101001001011100001000100101110111111011101110101010011001110111111101001011010110000101000',
            '0001011110101111110100110010010110011100111010011001001110011111011110001001011101111000101010001111000111000101111000100011100010100010010100010000',
            '0001000001011110010010100001100010111111000111001111010101011111011110001001011101111001010010100101110110111111001111110010111100111010110011110000',
            '0001111100100010101100010111000000011011001111001101101001000010001111011010001000111101111000000101111001110101101001101010001110100111101011001000',
        ]

        bursts_expected_6 = [
            '0001101101111011000010001000000010001110101111001111111111110001011011101111000100101110110001011010110110100111000000010010101110111001111011000000',
            '0001101000100010100001101100100101011100111000001101001010100010011101011000001001110100011100101100000010110101011011100111111011111101100000011000',
            '0001010110101101110000011111101100001000001001110101100000011010001111011010001000111100000100110001111110110111010101011011011100111000101111010000',
            '0000010000111000010001010010111110000100011000000101110110001000110101110010000011010111001100010011100001111101000101011110100001100010010110001000',
            '0001000101001011001111111101010111110010010110111111110000010001011011101111000100101111000100010000111110011101000001111100001001100100011100011000',
            '0001101101101010110000001001110111001001000001110110110000110001001011100001000100101111100001110001000000110101100001111111001001111001101101100000',
            '0000110011100000100000000010100100011001001000110010110101111001001011100001000100101110000111001100111111110011011001000001001000001111001101001000',
            '0001001111100001110110001010100011100011110011100001010100001001001011100001000100101111001000101100111101001010111000010111101000000001101100101000',
            '0000000011001001101001100111101011001011000100101100101001100010001111011010001000111101100100101001010100111000010001011000100110010101010111000000',
            '0001111000011111011100011010110000000010000000100000111000100010011101011000001001110100011101011101001001000111011101100001011010101000011011011000',
            '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000',
            '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000',
        ]

        bursts_expected_7 = [
            '0000011110101100001001101000001010010100100111101101101000110101001111101100010100111111011001110000011000100001010011100000001100010110101001001000',
            '0001110111101011100000001011111101100110110001001100101111110010000111011101001000011101110010001111000010011110001101101111101011100001001100100000',
            '0001111110100011001100101111001001101000101110011100011000100001001011100001000100101110000110110010111111110101000110001011010110011010100011001000',
            '0001011100010110000001011011001100000101010000011010001000111111011110001001011101111001101111000011111110011001000010000011000101100011111001010000',
            '0000101001000010000001100001000011001010100011110111101110111001001011100001000100101110001010100101111010111000000010111011000010011001101000001000',
            '0001101000000100110100110001010111010111111001101110110101100111011110001001011101111001000110010011100100000100011101110110111010001001000111101000',
            '0000100000100110011100101001110010011011100010101101111001110010001111011010001000111101100000111011110010010111001100100010000101111111011101110000',
            '0000100111111010101000001110100011010010010010100001011010110000110101110010000011010110011000111000111111000100001010010000011011001000011100110000',
            '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000',
            '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000',
            '0000100101100011001010101100011110000111001110010010010000100001011011101111000100101110001111010000001000001101011010110101010111011011001101101000',
            '0000110000111101100001011100100011101011011000111100001000000111011110001001011101111000111000000111100100101000000101100011011001111100110011110000',
        ]

        src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input,
                                 self.bursts_input)
        splitter = grgsm.burst_sdcch_subslot_splitter(grgsm.SPLITTER_SDCCH8)
        sink_0 = grgsm.burst_sink()
        sink_1 = grgsm.burst_sink()
        sink_2 = grgsm.burst_sink()
        sink_3 = grgsm.burst_sink()
        sink_4 = grgsm.burst_sink()
        sink_5 = grgsm.burst_sink()
        sink_6 = grgsm.burst_sink()
        sink_7 = grgsm.burst_sink()

        self.tb.msg_connect(src, "out", splitter, "in")
        self.tb.msg_connect(splitter, "out0", sink_0, "in")
        self.tb.msg_connect(splitter, "out1", sink_1, "in")
        self.tb.msg_connect(splitter, "out2", sink_2, "in")
        self.tb.msg_connect(splitter, "out3", sink_3, "in")
        self.tb.msg_connect(splitter, "out4", sink_4, "in")
        self.tb.msg_connect(splitter, "out5", sink_5, "in")
        self.tb.msg_connect(splitter, "out6", sink_6, "in")
        self.tb.msg_connect(splitter, "out7", sink_7, "in")

        self.tb.run()

        bursts_result_0 = list(sink_0.get_burst_data())
        bursts_result_1 = list(sink_1.get_burst_data())
        bursts_result_2 = list(sink_2.get_burst_data())
        bursts_result_3 = list(sink_3.get_burst_data())
        bursts_result_4 = list(sink_4.get_burst_data())
        bursts_result_5 = list(sink_5.get_burst_data())
        bursts_result_6 = list(sink_6.get_burst_data())
        bursts_result_7 = list(sink_7.get_burst_data())

        self.assertEqual(bursts_expected_0, bursts_result_0)
        self.assertEqual(bursts_expected_1, bursts_result_1)
        self.assertEqual(bursts_expected_2, bursts_result_2)
        self.assertEqual(bursts_expected_3, bursts_result_3)
        self.assertEqual(bursts_expected_4, bursts_result_4)
        self.assertEqual(bursts_expected_5, bursts_result_5)
        self.assertEqual(bursts_expected_6, bursts_result_6)
        self.assertEqual(bursts_expected_7, bursts_result_7)