Exemplo n.º 1
0
    def test_pattern(self):
        'Test probes are filled with the requested bit pattern'

        with mtrpacket.PacketListen('-4') as listen:
            cmd = '20 send-probe ip-4 127.0.0.1 bit-pattern 44'

            self.write_command(cmd)

        self.assertEqual(listen.attrib['bitpattern'], '44')
Exemplo n.º 2
0
    def test_tos(self):
        'Test setting the TOS field'

        with mtrpacket.PacketListen('-4') as listen:
            cmd = '20 send-probe ip-4 127.0.0.1 tos 62'

            self.write_command(cmd)

        self.assertEqual(listen.attrib['tos'], '62')
Exemplo n.º 3
0
    def test_size(self):
        'Test probes sent with an explicit packet size'

        with mtrpacket.PacketListen('-4') as listen:
            cmd = '20 send-probe ip-4 127.0.0.1 size 512'

            self.write_command(cmd)

        self.assertEqual(listen.attrib['size'], '512')
Exemplo n.º 4
0
    def test_param(self):
        'Test a variety of packet parameters'

        with mtrpacket.PacketListen('-6') as listen:
            param = 'size 256 bit-pattern 51 tos 77'
            cmd = '20 send-probe ip-6 ::1 ' + param

            self.write_command(cmd)

        self.assertEqual(listen.attrib['size'], '256')
        self.assertEqual(listen.attrib['bitpattern'], '51')