def test_empty_confirm_message(self): bundle = TransactionBundle( incoming_message=ConfirmMessage(transaction_id=b'abcd'), received_over_multicast=True, marks=['one']) self.message_handler.handle(bundle, StatisticsSet()) result = bundle.outgoing_message # ConfirmMessage without IANAOption/IATAOption/IAPDOption must be ignored self.assertIsNone(result)
def test_empty_confirm_message(self): with self.assertLogs() as cm: bundle = TransactionBundle( incoming_message=ConfirmMessage(transaction_id=b'abcd'), received_over_multicast=True, marks=['one']) self.message_handler.handle(bundle, StatisticsSet()) result = bundle.outgoing_message self.assertEqual(len(cm.output), 1) self.assertRegex(cm.output[0], '^WARNING:.*:No IAs present in confirm reply') # ConfirmMessage without IANAOption/IATAOption/IAPDOption must be ignored self.assertIsNone(result)
The encapsulated-options field conveys options specific to the OPTION_S46_CONT_LW option. Currently, there are two options specified: OPTION_S46_V4V6BIND and OPTION_S46_BR. There MUST be at most one OPTION_S46_V4V6BIND option and at least one OPTION_S46_BR option. """ option_type = OPTION_S46_CONT_LW # Register where these options may occur SolicitMessage.add_may_contain(S46ContainerOption) AdvertiseMessage.add_may_contain(S46ContainerOption) RequestMessage.add_may_contain(S46ContainerOption) ConfirmMessage.add_may_contain(S46ContainerOption) RenewMessage.add_may_contain(S46ContainerOption) RebindMessage.add_may_contain(S46ContainerOption) ReleaseMessage.add_may_contain(S46ContainerOption) ReplyMessage.add_may_contain(S46ContainerOption) S46RuleOption.add_may_contain(S46PortParametersOption) S46V4V6BindingOption.add_may_contain(S46PortParametersOption) S46MapEContainerOption.add_may_contain(S46RuleOption, min_occurrence=1) S46MapEContainerOption.add_may_contain(S46BROption, min_occurrence=1) S46MapEContainerOption.add_may_contain(S46PortParametersOption) S46MapTContainerOption.add_may_contain(S46RuleOption, min_occurrence=1) S46MapTContainerOption.add_may_contain(S46DMROption, min_occurrence=1, max_occurrence=1)
:return: The buffer with the data from this element """ options_buffer = bytearray() for option in self.options: options_buffer.extend(option.save()) buffer = bytearray() buffer.extend( pack('!HHIIB', self.option_type, len(options_buffer) + 25, self.preferred_lifetime, self.valid_lifetime, self.prefix.prefixlen)) buffer.extend(self.prefix.network_address.packed) buffer.extend(options_buffer) return buffer # Register where these options may occur SolicitMessage.add_may_contain(IAPDOption) AdvertiseMessage.add_may_contain(IAPDOption) RequestMessage.add_may_contain(IAPDOption) ConfirmMessage.add_may_contain(IAPDOption) RenewMessage.add_may_contain(IAPDOption) RebindMessage.add_may_contain(IAPDOption) ReleaseMessage.add_may_contain(IAPDOption) ReplyMessage.add_may_contain(IAPDOption) IAPDOption.add_may_contain(IAPrefixOption) IAPDOption.add_may_contain(StatusCodeOption, 0, 1) IAPrefixOption.add_may_contain(StatusCodeOption, 0, 1)
The encapsulated-options field conveys options specific to the OPTION_S46_CONT_LW option. Currently, there are two options specified: OPTION_S46_V4V6BIND and OPTION_S46_BR. There MUST be at most one OPTION_S46_V4V6BIND option and at least one OPTION_S46_BR option. """ option_type = OPTION_S46_CONT_LW # Register where these options may occur SolicitMessage.add_may_contain(S46ContainerOption) AdvertiseMessage.add_may_contain(S46ContainerOption) RequestMessage.add_may_contain(S46ContainerOption) ConfirmMessage.add_may_contain(S46ContainerOption) RenewMessage.add_may_contain(S46ContainerOption) RebindMessage.add_may_contain(S46ContainerOption) ReleaseMessage.add_may_contain(S46ContainerOption) ReplyMessage.add_may_contain(S46ContainerOption) S46RuleOption.add_may_contain(S46PortParametersOption) S46V4V6BindingOption.add_may_contain(S46PortParametersOption) S46MapEContainerOption.add_may_contain(S46RuleOption, min_occurrence=1) S46MapEContainerOption.add_may_contain(S46BROption, min_occurrence=1) S46MapEContainerOption.add_may_contain(S46PortParametersOption) S46MapTContainerOption.add_may_contain(S46RuleOption, min_occurrence=1) S46MapTContainerOption.add_may_contain(S46DMROption,
confirm_message = ConfirmMessage( transaction_id=bytes.fromhex('f350d6'), options=[ ElapsedTimeOption(elapsed_time=104), ClientIdOption(duid=LinkLayerDUID(hardware_type=1, link_layer_address=bytes.fromhex( '3431c43cb2f1'))), IANAOption(iaid=bytes.fromhex('c43cb2f1'), options=[ IAAddressOption( address=IPv6Address('2001:db8:ffff:1:c::e09c'), preferred_lifetime=375, valid_lifetime=600), ]), IAPDOption(iaid=bytes.fromhex('c43cb2f1'), options=[ IAPrefixOption( prefix=IPv6Network('2001:db8:ffcc:fe00::/56'), preferred_lifetime=375, valid_lifetime=600), ]), OptionRequestOption(requested_options=[ OPTION_DNS_SERVERS, OPTION_NTP_SERVER, OPTION_SNTP_SERVERS, OPTION_IA_PD, OPTION_IA_NA, OPTION_VENDOR_OPTS, OPTION_SOL_MAX_RT, OPTION_INF_MAX_RT, ]), VendorClassOption(enterprise_number=872), ], )
:return: The buffer with the data from this element """ self.validate() options_buffer = bytearray() for option in self.options: options_buffer.extend(option.save()) buffer = bytearray() buffer.extend(pack('!HHIIB', self.option_type, len(options_buffer) + 25, self.preferred_lifetime, self.valid_lifetime, self.prefix.prefixlen)) buffer.extend(self.prefix.network_address.packed) buffer.extend(options_buffer) return buffer # Register where these options may occur SolicitMessage.add_may_contain(IAPDOption) AdvertiseMessage.add_may_contain(IAPDOption) RequestMessage.add_may_contain(IAPDOption) ConfirmMessage.add_may_contain(IAPDOption) RenewMessage.add_may_contain(IAPDOption) RebindMessage.add_may_contain(IAPDOption) ReleaseMessage.add_may_contain(IAPDOption) ReplyMessage.add_may_contain(IAPDOption) IAPDOption.add_may_contain(IAPrefixOption) IAPDOption.add_may_contain(StatusCodeOption, 0, 1) IAPrefixOption.add_may_contain(StatusCodeOption, 0, 1)