#!/usr/bin/env python3
#
#  Copyright (c) 2016, The OpenThread Authors.
#  All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions are met:
#  1. Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#  2. Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#  3. Neither the name of the copyright holder nor the
#     names of its contributors may be used to endorse or promote products
#     derived from this software without specific prior written permission.
#
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#  POSSIBILITY OF SUCH DAMAGE.
#

import io
import random
import struct
import unittest

import common
import network_layer


def any_eid():
    return bytearray([random.getrandbits(8) for _ in range(16)])


def any_mac_extended_address():
    return bytearray([random.getrandbits(8) for _ in range(8)])


def any_rloc16():
    return random.getrandbits(16)


def any_ml_eid():
    return bytearray([random.getrandbits(8) for _ in range(8)])


def any_status():
    return random.getrandbits(1)


def any_seconds():
    return random.getrandbits(32)


def any_id_sequence():
    return random.getrandbits(8)


def any_router_id_mask():
    return random.getrandbits(64)


def any_options(count=None):
    count = count if count is not None else random.randint(0, 255)
    return [random.getrandbits(8) for _ in range(count)]


def any_tlv_data(length=None):
    _type = random.getrandbits(8)
    length = length if length is not None else random.getrandbits(8)
    value = bytearray([random.getrandbits(8) for _ in range(length)])

    return bytearray([_type, length]) + value


def any_tlvs_data(count=None):
    count = count if count is not None else random.randint(0, 16)
    data = bytearray()

    for _ in range(count):
        data += any_tlv_data(random.randint(1, 15))

    return data


class TestTargetEid(unittest.TestCase):

    def test_should_return_eid_value_when_eid_property_is_called(self):
        # GIVEN
        eid = any_eid()

        target_eid = network_layer.TargetEid(eid)

        # WHEN
        actual_eid = target_eid.eid

        # THEN
        self.assertEqual(eid, actual_eid)

    def test_should_return_True_when_try_to_equal_two_the_same_type_objects_with_the_same_values(self):
        # GIVEN
        eid = any_eid()

        target_eid = network_layer.TargetEid(eid)

        # THEN
        self.assertEqual(target_eid, network_layer.TargetEid(eid))


class TestTargetEidFactory(unittest.TestCase):

    def test_should_create_TargetEid_from_bytearray_when_parse_method_is_called(self):
        # GIVEN
        eid = any_eid()

        factory = network_layer.TargetEidFactory()

        # WHEN
        target_eid = factory.parse(io.BytesIO(eid), common.MessageInfo())

        # THEN
        self.assertTrue(isinstance(target_eid, network_layer.TargetEid))
        self.assertEqual(eid, target_eid.eid)


class TestMacExtendedAddress(unittest.TestCase):

    def test_should_return_mac_address_value_when_mac_address_property_is_called(self):
        # GIVEN
        mac_address = any_mac_extended_address()

        mac_extended_address = network_layer.MacExtendedAddress(mac_address)

        # WHEN
        actual_mac_address = mac_extended_address.mac_address

        # THEN
        self.assertEqual(mac_address, actual_mac_address)

    def test_should_return_True_when_try_to_equal_two_the_same_type_objects_with_the_same_values(self):
        # GIVEN
        mac_address = any_mac_extended_address()

        mac_extended_address = network_layer.MacExtendedAddress(mac_address)

        # THEN
        self.assertEqual(mac_extended_address, network_layer.MacExtendedAddress(mac_address))


class TestMacExtendedAddressFactory(unittest.TestCase):

    def test_should_create_MacExtendedAddress_from_bytearray_when_parse_method_is_called(self):
        # GIVEN
        mac_address = any_mac_extended_address()

        factory = network_layer.MacExtendedAddressFactory()

        # WHEN
        mac_extended_address = factory.parse(io.BytesIO(mac_address), common.MessageInfo())

        # THEN
        self.assertTrue(isinstance(mac_extended_address, network_layer.MacExtendedAddress))
        self.assertEqual(mac_address, mac_extended_address.mac_address)


class TestRloc16(unittest.TestCase):

    def test_should_return_rloc16_value_when_rloc16_property_is_called(self):
        # GIVEN
        rloc16 = any_rloc16()

        rloc16_obj = network_layer.Rloc16(rloc16)

        # WHEN
        actual_rloc16 = rloc16_obj.rloc16

        # THEN
        self.assertEqual(rloc16, actual_rloc16)

    def test_should_return_True_when_try_to_equal_two_the_same_type_objects_with_the_same_values(self):
        # GIVEN
        rloc16 = any_rloc16()

        rloc16_obj = network_layer.Rloc16(rloc16)

        # THEN
        self.assertEqual(rloc16_obj, network_layer.Rloc16(rloc16))


class TestRloc16Factory(unittest.TestCase):

    def test_should_create_Rloc16_from_bytearray_when_parse_method_is_called(self):
        # GIVEN
        rloc16 = any_rloc16()

        factory = network_layer.Rloc16Factory()

        data = bytearray(struct.pack(">H", rloc16))

        # WHEN
        rloc16_obj = factory.parse(io.BytesIO(data), common.MessageInfo())

        # THEN
        self.assertTrue(isinstance(rloc16_obj, network_layer.Rloc16))
        self.assertEqual(rloc16, rloc16_obj.rloc16)


class TestMlEid(unittest.TestCase):

    def test_should_return_ml_eid_value_when_ml_eid_property_is_called(self):
        # GIVEN
        ml_eid = any_ml_eid()

        ml_eid_obj = network_layer.MlEid(ml_eid)

        # WHEN
        actual_ml_eid = ml_eid_obj.ml_eid

        # THEN
        self.assertEqual(ml_eid, actual_ml_eid)

    def test_should_return_True_when_try_to_equal_two_the_same_type_objects_with_the_same_values(self):
        # GIVEN
        ml_eid = any_ml_eid()

        ml_eid_obj = network_layer.MlEid(ml_eid)

        # THEN
        self.assertEqual(ml_eid_obj, network_layer.MlEid(ml_eid))


class TestMlEidFactory(unittest.TestCase):

    def test_should_create_MlEid_from_bytearray_when_parse_method_is_called(self):
        # GIVEN
        ml_eid = any_ml_eid()

        factory = network_layer.MlEidFactory()

        # WHEN
        ml_eid_obj = factory.parse(io.BytesIO(ml_eid), common.MessageInfo())

        # THEN
        self.assertTrue(isinstance(ml_eid_obj, network_layer.MlEid))
        self.assertEqual(ml_eid, ml_eid_obj.ml_eid)


class TestStatus(unittest.TestCase):

    def test_should_return_status_value_when_status_property_is_called(self):
        # GIVEN
        status = any_status()

        status_obj = network_layer.Status(status)

        # WHEN
        actual_status = status_obj.status

        # THEN
        self.assertEqual(status, actual_status)

    def test_should_return_True_when_try_to_equal_two_the_same_type_objects_with_the_same_values(self):
        # GIVEN
        status = any_status()

        status_obj = network_layer.Status(status)

        # THEN
        self.assertEqual(status_obj, network_layer.Status(status))


class TestStatusFactory(unittest.TestCase):

    def test_should_create_Status_from_bytearray_when_parse_method_is_called(self):
        # GIVEN
        status = any_status()

        factory = network_layer.StatusFactory()

        data = bytearray([status])

        # WHEN
        status_obj = factory.parse(io.BytesIO(data), common.MessageInfo())

        # THEN
        self.assertTrue(isinstance(status_obj, network_layer.Status))
        self.assertEqual(status, status_obj.status)


class TestTimeSinceLastTransaction(unittest.TestCase):

    def test_should_return_seconds_value_when_seconds_property_is_called(self):
        # GIVEN
        seconds = any_seconds()

        time_since_last_transaction = network_layer.TimeSinceLastTransaction(seconds)

        # WHEN
        actual_seconds = time_since_last_transaction.seconds

        # THEN
        self.assertEqual(seconds, actual_seconds)

    def test_should_return_True_when_try_to_equal_two_the_same_type_objects_with_the_same_values(self):
        # GIVEN
        seconds = any_seconds()

        time_since_last_transaction = network_layer.TimeSinceLastTransaction(seconds)

        # THEN
        self.assertEqual(
            time_since_last_transaction,
            network_layer.TimeSinceLastTransaction(seconds),
        )


class TestTimeSinceLastTransactionFactory(unittest.TestCase):

    def test_should_create_TimeSinceLastTransaction_from_bytearray_when_parse_method_is_called(self):
        # GIVEN
        seconds = any_seconds()

        factory = network_layer.TimeSinceLastTransactionFactory()

        data = bytearray(struct.pack(">L", seconds))

        # WHEN
        time_since_last_transaction = factory.parse(io.BytesIO(data), common.MessageInfo())

        # THEN
        self.assertTrue(isinstance(
            time_since_last_transaction,
            network_layer.TimeSinceLastTransaction,
        ))
        self.assertEqual(seconds, time_since_last_transaction.seconds)


class TestRouterMask(unittest.TestCase):

    def test_should_return_id_sequence_value_when_id_sequence_property_is_called(self):
        # GIVEN
        id_sequence = any_id_sequence()

        router_mask = network_layer.RouterMask(id_sequence, any_router_id_mask())

        # WHEN
        actual_id_sequence = router_mask.id_sequence

        # THEN
        self.assertEqual(id_sequence, actual_id_sequence)

    def test_should_return_router_id_mask_value_when_router_id_mask_property_is_called(self):
        # GIVEN
        router_id_mask = any_router_id_mask()

        router_mask = network_layer.RouterMask(any_id_sequence(), router_id_mask)

        # WHEN
        actual_router_id_mask = router_mask.router_id_mask

        # THEN
        self.assertEqual(router_id_mask, actual_router_id_mask)

    def test_should_return_True_when_try_to_equal_two_the_same_type_objects_with_the_same_values(self):
        # GIVEN
        id_sequence = any_id_sequence()
        router_id_mask = any_router_id_mask()

        router_mask = network_layer.RouterMask(id_sequence, router_id_mask)

        # THEN
        self.assertEqual(router_mask, network_layer.RouterMask(id_sequence, router_id_mask))


class TestRouterMaskFactory(unittest.TestCase):

    def test_should_create_RouterMask_from_bytearray_when_parse_method_is_called(self):
        # GIVEN
        id_sequence = any_id_sequence()
        router_id_mask = any_router_id_mask()

        factory = network_layer.RouterMaskFactory()

        data = bytearray([id_sequence]) + struct.pack(">Q", router_id_mask)

        # WHEN
        router_mask = factory.parse(io.BytesIO(data), common.MessageInfo())

        # THEN
        self.assertTrue(isinstance(router_mask, network_layer.RouterMask))
        self.assertEqual(id_sequence, router_mask.id_sequence)
        self.assertEqual(router_id_mask, router_mask.router_id_mask)


class TestNdOption(unittest.TestCase):

    def test_should_return_options_value_when_options_property_is_called(self):
        # GIVEN
        options = any_options()

        nd_option = network_layer.NdOption(options)

        # WHEN
        actual_options = nd_option.options

        # THEN
        self.assertEqual(options, actual_options)

    def test_should_return_True_when_try_to_equal_two_the_same_type_objects_with_the_same_values(self):
        # GIVEN
        options = any_options()

        nd_option = network_layer.NdOption(options)

        # THEN
        self.assertEqual(nd_option, network_layer.NdOption(options))


class TestNdOptionFactory(unittest.TestCase):

    def test_should_create_NdOption_from_bytearray_when_parse_method_is_called(self):
        # GIVEN
        options = any_options()

        factory = network_layer.NdOptionFactory()

        data = bytearray(options)

        # WHEN
        nd_option = factory.parse(io.BytesIO(data), common.MessageInfo())

        # THEN
        self.assertTrue(isinstance(nd_option, network_layer.NdOption))
        self.assertEqual(options, nd_option.options)


class TestThreadNetworkData(unittest.TestCase):

    def test_should_return_options_value_when_options_property_is_called(self):
        # GIVEN
        tlvs = any_tlvs_data()

        thread_network_data = network_layer.ThreadNetworkData(tlvs)

        # WHEN
        actual_tlvs = thread_network_data.tlvs

        # THEN
        self.assertEqual(tlvs, actual_tlvs)

    def test_should_return_True_when_try_to_equal_two_the_same_type_objects_with_the_same_values(self):
        # GIVEN
        tlvs = any_tlvs_data()

        thread_network_data = network_layer.ThreadNetworkData(tlvs)

        # THEN
        self.assertEqual(thread_network_data, network_layer.ThreadNetworkData(tlvs))


class TestThreadNetworkDataFactory(unittest.TestCase):

    def test_should_create_ThreadNetworkData_from_bytearray_when_parse_method_is_called(self):
        # GIVEN
        tlvs = any_tlvs_data()

        class DummyNetworkDataTlvsFactory:

            def parse(self, data, message_info):
                return bytearray(data.read())

        factory = network_layer.ThreadNetworkDataFactory(DummyNetworkDataTlvsFactory())

        # WHEN
        thread_network_data = factory.parse(io.BytesIO(tlvs), common.MessageInfo())

        # THEN
        self.assertTrue(isinstance(thread_network_data, network_layer.ThreadNetworkData))
        self.assertEqual(tlvs, thread_network_data.tlvs)


if __name__ == "__main__":
    unittest.main()

[((1906, 1928), 'random.getrandbits', 'random.getrandbits', (['(16)'], {}), '(16)\n', (1924, 1928), False, 'import random\n'), ((2044, 2065), 'random.getrandbits', 'random.getrandbits', (['(1)'], {}), '(1)\n', (2062, 2065), False, 'import random\n'), ((2098, 2120), 'random.getrandbits', 'random.getrandbits', (['(32)'], {}), '(32)\n', (2116, 2120), False, 'import random\n'), ((2157, 2178), 'random.getrandbits', 'random.getrandbits', (['(8)'], {}), '(8)\n', (2175, 2178), False, 'import random\n'), ((2218, 2240), 'random.getrandbits', 'random.getrandbits', (['(64)'], {}), '(64)\n', (2236, 2240), False, 'import random\n'), ((2441, 2462), 'random.getrandbits', 'random.getrandbits', (['(8)'], {}), '(8)\n', (2459, 2462), False, 'import random\n'), ((14517, 14532), 'unittest.main', 'unittest.main', ([], {}), '()\n', (14530, 14532), False, 'import unittest\n'), ((2316, 2338), 'random.randint', 'random.randint', (['(0)', '(255)'], {}), '(0, 255)\n', (2330, 2338), False, 'import random\n'), ((2351, 2372), 'random.getrandbits', 'random.getrandbits', (['(8)'], {}), '(8)\n', (2369, 2372), False, 'import random\n'), ((2510, 2531), 'random.getrandbits', 'random.getrandbits', (['(8)'], {}), '(8)\n', (2528, 2531), False, 'import random\n'), ((2726, 2747), 'random.randint', 'random.randint', (['(0)', '(16)'], {}), '(0, 16)\n', (2740, 2747), False, 'import random\n'), ((3045, 3073), 'network_layer.TargetEid', 'network_layer.TargetEid', (['eid'], {}), '(eid)\n', (3068, 3073), False, 'import network_layer\n'), ((3351, 3379), 'network_layer.TargetEid', 'network_layer.TargetEid', (['eid'], {}), '(eid)\n', (3374, 3379), False, 'import network_layer\n'), ((3659, 3691), 'network_layer.TargetEidFactory', 'network_layer.TargetEidFactory', ([], {}), '()\n', (3689, 3691), False, 'import network_layer\n'), ((4154, 4199), 'network_layer.MacExtendedAddress', 'network_layer.MacExtendedAddress', (['mac_address'], {}), '(mac_address)\n', (4186, 4199), False, 'import network_layer\n'), ((4554, 4599), 'network_layer.MacExtendedAddress', 'network_layer.MacExtendedAddress', (['mac_address'], {}), '(mac_address)\n', (4586, 4599), False, 'import network_layer\n'), ((4949, 4990), 'network_layer.MacExtendedAddressFactory', 'network_layer.MacExtendedAddressFactory', ([], {}), '()\n', (4988, 4990), False, 'import network_layer\n'), ((5465, 5493), 'network_layer.Rloc16', 'network_layer.Rloc16', (['rloc16'], {}), '(rloc16)\n', (5485, 5493), False, 'import network_layer\n'), ((5789, 5817), 'network_layer.Rloc16', 'network_layer.Rloc16', (['rloc16'], {}), '(rloc16)\n', (5809, 5817), False, 'import network_layer\n'), ((6097, 6126), 'network_layer.Rloc16Factory', 'network_layer.Rloc16Factory', ([], {}), '()\n', (6124, 6126), False, 'import network_layer\n'), ((6594, 6621), 'network_layer.MlEid', 'network_layer.MlEid', (['ml_eid'], {}), '(ml_eid)\n', (6613, 6621), False, 'import network_layer\n'), ((6917, 6944), 'network_layer.MlEid', 'network_layer.MlEid', (['ml_eid'], {}), '(ml_eid)\n', (6936, 6944), False, 'import network_layer\n'), ((7221, 7249), 'network_layer.MlEidFactory', 'network_layer.MlEidFactory', ([], {}), '()\n', (7247, 7249), False, 'import network_layer\n'), ((7666, 7694), 'network_layer.Status', 'network_layer.Status', (['status'], {}), '(status)\n', (7686, 7694), False, 'import network_layer\n'), ((7990, 8018), 'network_layer.Status', 'network_layer.Status', (['status'], {}), '(status)\n', (8010, 8018), False, 'import network_layer\n'), ((8298, 8327), 'network_layer.StatusFactory', 'network_layer.StatusFactory', ([], {}), '()\n', (8325, 8327), False, 'import network_layer\n'), ((8818, 8865), 'network_layer.TimeSinceLastTransaction', 'network_layer.TimeSinceLastTransaction', (['seconds'], {}), '(seconds)\n', (8856, 8865), False, 'import network_layer\n'), ((9201, 9248), 'network_layer.TimeSinceLastTransaction', 'network_layer.TimeSinceLastTransaction', (['seconds'], {}), '(seconds)\n', (9239, 9248), False, 'import network_layer\n'), ((9637, 9684), 'network_layer.TimeSinceLastTransactionFactory', 'network_layer.TimeSinceLastTransactionFactory', ([], {}), '()\n', (9682, 9684), False, 'import network_layer\n'), ((11113, 11166), 'network_layer.RouterMask', 'network_layer.RouterMask', (['id_sequence', 'router_id_mask'], {}), '(id_sequence, router_id_mask)\n', (11137, 11166), False, 'import network_layer\n'), ((11536, 11569), 'network_layer.RouterMaskFactory', 'network_layer.RouterMaskFactory', ([], {}), '()\n', (11567, 11569), False, 'import network_layer\n'), ((12153, 12184), 'network_layer.NdOption', 'network_layer.NdOption', (['options'], {}), '(options)\n', (12175, 12184), False, 'import network_layer\n'), ((12484, 12515), 'network_layer.NdOption', 'network_layer.NdOption', (['options'], {}), '(options)\n', (12506, 12515), False, 'import network_layer\n'), ((12803, 12834), 'network_layer.NdOptionFactory', 'network_layer.NdOptionFactory', ([], {}), '()\n', (12832, 12834), False, 'import network_layer\n'), ((13309, 13346), 'network_layer.ThreadNetworkData', 'network_layer.ThreadNetworkData', (['tlvs'], {}), '(tlvs)\n', (13340, 13346), False, 'import network_layer\n'), ((13653, 13690), 'network_layer.ThreadNetworkData', 'network_layer.ThreadNetworkData', (['tlvs'], {}), '(tlvs)\n', (13684, 13690), False, 'import network_layer\n'), ((1734, 1755), 'random.getrandbits', 'random.getrandbits', (['(8)'], {}), '(8)\n', (1752, 1755), False, 'import random\n'), ((1833, 1854), 'random.getrandbits', 'random.getrandbits', (['(8)'], {}), '(8)\n', (1851, 1854), False, 'import random\n'), ((1971, 1992), 'random.getrandbits', 'random.getrandbits', (['(8)'], {}), '(8)\n', (1989, 1992), False, 'import random\n'), ((2555, 2576), 'random.getrandbits', 'random.getrandbits', (['(8)'], {}), '(8)\n', (2573, 2576), False, 'import random\n'), ((2828, 2849), 'random.randint', 'random.randint', (['(1)', '(15)'], {}), '(1, 15)\n', (2842, 2849), False, 'import random\n'), ((3433, 3461), 'network_layer.TargetEid', 'network_layer.TargetEid', (['eid'], {}), '(eid)\n', (3456, 3461), False, 'import network_layer\n'), ((3743, 3758), 'io.BytesIO', 'io.BytesIO', (['eid'], {}), '(eid)\n', (3753, 3758), False, 'import io\n'), ((3760, 3780), 'common.MessageInfo', 'common.MessageInfo', ([], {}), '()\n', (3778, 3780), False, 'import common\n'), ((4663, 4708), 'network_layer.MacExtendedAddress', 'network_layer.MacExtendedAddress', (['mac_address'], {}), '(mac_address)\n', (4695, 4708), False, 'import network_layer\n'), ((5052, 5075), 'io.BytesIO', 'io.BytesIO', (['mac_address'], {}), '(mac_address)\n', (5062, 5075), False, 'import io\n'), ((5077, 5097), 'common.MessageInfo', 'common.MessageInfo', ([], {}), '()\n', (5095, 5097), False, 'import common\n'), ((5871, 5899), 'network_layer.Rloc16', 'network_layer.Rloc16', (['rloc16'], {}), '(rloc16)\n', (5891, 5899), False, 'import network_layer\n'), ((6153, 6178), 'struct.pack', 'struct.pack', (['""">H"""', 'rloc16'], {}), "('>H', rloc16)\n", (6164, 6178), False, 'import struct\n'), ((6231, 6247), 'io.BytesIO', 'io.BytesIO', (['data'], {}), '(data)\n', (6241, 6247), False, 'import io\n'), ((6249, 6269), 'common.MessageInfo', 'common.MessageInfo', ([], {}), '()\n', (6267, 6269), False, 'import common\n'), ((6998, 7025), 'network_layer.MlEid', 'network_layer.MlEid', (['ml_eid'], {}), '(ml_eid)\n', (7017, 7025), False, 'import network_layer\n'), ((7301, 7319), 'io.BytesIO', 'io.BytesIO', (['ml_eid'], {}), '(ml_eid)\n', (7311, 7319), False, 'import io\n'), ((7321, 7341), 'common.MessageInfo', 'common.MessageInfo', ([], {}), '()\n', (7339, 7341), False, 'import common\n'), ((8072, 8100), 'network_layer.Status', 'network_layer.Status', (['status'], {}), '(status)\n', (8092, 8100), False, 'import network_layer\n'), ((8415, 8431), 'io.BytesIO', 'io.BytesIO', (['data'], {}), '(data)\n', (8425, 8431), False, 'import io\n'), ((8433, 8453), 'common.MessageInfo', 'common.MessageInfo', ([], {}), '()\n', (8451, 8453), False, 'import common\n'), ((9344, 9391), 'network_layer.TimeSinceLastTransaction', 'network_layer.TimeSinceLastTransaction', (['seconds'], {}), '(seconds)\n', (9382, 9391), False, 'import network_layer\n'), ((9711, 9737), 'struct.pack', 'struct.pack', (['""">L"""', 'seconds'], {}), "('>L', seconds)\n", (9722, 9737), False, 'import struct\n'), ((9807, 9823), 'io.BytesIO', 'io.BytesIO', (['data'], {}), '(data)\n', (9817, 9823), False, 'import io\n'), ((9825, 9845), 'common.MessageInfo', 'common.MessageInfo', ([], {}), '()\n', (9843, 9845), False, 'import common\n'), ((11221, 11274), 'network_layer.RouterMask', 'network_layer.RouterMask', (['id_sequence', 'router_id_mask'], {}), '(id_sequence, router_id_mask)\n', (11245, 11274), False, 'import network_layer\n'), ((11613, 11646), 'struct.pack', 'struct.pack', (['""">Q"""', 'router_id_mask'], {}), "('>Q', router_id_mask)\n", (11624, 11646), False, 'import struct\n'), ((11699, 11715), 'io.BytesIO', 'io.BytesIO', (['data'], {}), '(data)\n', (11709, 11715), False, 'import io\n'), ((11717, 11737), 'common.MessageInfo', 'common.MessageInfo', ([], {}), '()\n', (11735, 11737), False, 'import common\n'), ((12568, 12599), 'network_layer.NdOption', 'network_layer.NdOption', (['options'], {}), '(options)\n', (12590, 12599), False, 'import network_layer\n'), ((12920, 12936), 'io.BytesIO', 'io.BytesIO', (['data'], {}), '(data)\n', (12930, 12936), False, 'import io\n'), ((12938, 12958), 'common.MessageInfo', 'common.MessageInfo', ([], {}), '()\n', (12956, 12958), False, 'import common\n'), ((13753, 13790), 'network_layer.ThreadNetworkData', 'network_layer.ThreadNetworkData', (['tlvs'], {}), '(tlvs)\n', (13784, 13790), False, 'import network_layer\n'), ((14281, 14297), 'io.BytesIO', 'io.BytesIO', (['tlvs'], {}), '(tlvs)\n', (14291, 14297), False, 'import io\n'), ((14299, 14319), 'common.MessageInfo', 'common.MessageInfo', ([], {}), '()\n', (14317, 14319), False, 'import common\n')]