def create_deafult_network_tlvs_factories(): return { network_layer.TlvType.TARGET_EID: network_layer.TargetEidFactory(), network_layer.TlvType.MAC_EXTENDED_ADDRESS: network_layer.MacExtendedAddressFactory(), network_layer.TlvType.RLOC16: network_layer.Rloc16Factory(), network_layer.TlvType.ML_EID: network_layer.MlEidFactory(), network_layer.TlvType.STATUS: network_layer.StatusFactory(), network_layer.TlvType.TIME_SINCE_LAST_TRANSACTION: network_layer.TimeSinceLastTransactionFactory(), network_layer.TlvType.ROUTER_MASK: network_layer.RouterMaskFactory(), network_layer.TlvType.ND_OPTION: network_layer.NdOptionFactory(), network_layer.TlvType.ND_DATA: network_layer.NdDataFactory(), network_layer.TlvType.THREAD_NETWORK_DATA: network_layer.ThreadNetworkDataFactory( create_default_network_data_tlvs_factory()), # Routing information are distributed in a Thread network by MLE Routing TLV # which is in fact MLE Route64 TLV. Thread specificaton v1.1. - Chapter 5.20 network_layer.TlvType.MLE_ROUTING: create_default_mle_tlv_route64_factory() }
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)