Esempio n. 1
0
    def test_bad_ipv6_prefix_length(self):
        S46DMROption.parse(
            bytes.fromhex('005b00118020010db8000000000000000000000001'))

        with self.assertRaisesRegex(ValueError, 'range from 0 to 128'):
            S46DMROption.parse(
                bytes.fromhex('005b00118120010db800000000000000000000000100'))
Esempio n. 2
0
    def test_bad_ipv6_prefix_length(self):
        S46DMROption.parse(bytes.fromhex('005b00118020010db8000000000000000000000001'))

        with self.assertRaisesRegex(ValueError, 'range from 0 to 128'):
            S46DMROption.parse(
                bytes.fromhex('005b00118120010db800000000000000000000000100')
            )
Esempio n. 3
0
    def __init__(self,
                 dmr_prefix: IPv6Network,
                 rules: Iterable,
                 always_send: bool = False):
        options = list()
        options += [rule() for rule in rules]
        options += [S46DMROption(dmr_prefix=dmr_prefix)]

        option = S46MapTContainerOption(options=options)
        option.validate()

        super().__init__(option, always_send=always_send)
Esempio n. 4
0
 def test_bad_option_length(self):
     with self.assertRaisesRegex(ValueError, 'length does not match'):
         S46DMROption.parse(
             bytes.fromhex('005b00112020010db8000000000000000000000000'))
Esempio n. 5
0
    ipv6_prefix=IPv6Network('2001:db8::/34'),
    options=[s46_port_parameters_option_object])

# S46BROption
s46_br_option_bytes = bytes.fromhex(
    '005a'  # option_type: OPTION_S46_BR
    '0010'  # option_length
    '20010db8000000000000000000000001')  # 2001:db8::1
s46_br_option_object = S46BROption(br_address=IPv6Address('2001:db8::1'))

# S46DMROption
s46_dmr_option_bytes = bytes.fromhex('005b'  # option_type: OPTION_S46_DMR
                                     '0006'  # option_length
                                     '21'  # prefix_len
                                     '20010db800')  # 2001:db8::1
s46_dmr_option_object = S46DMROption(dmr_prefix=IPv6Network('2001:db8::/33'))

# S46V4V6BindingOption
s46_v4_v6_binding_option_bytes = (
    bytes.fromhex('005c'  # option_type: OPTION_S46_V4V6BIND
                  '0012'  # option_length
                  '01020304'  # ipv4_address
                  '22'  # ipv6_prefix_len
                  '20010db800')  # ipv6_prefix
    + s46_port_parameters_option_bytes)

s46_v4_v6_binding_option_object = S46V4V6BindingOption(
    ipv4_address=IPv4Address('1.2.3.4'),
    ipv6_prefix=IPv6Network('2001:db8::/34'),
    options=[s46_port_parameters_option_object])
Esempio n. 6
0
 def test_bad_option_length(self):
     with self.assertRaisesRegex(ValueError, 'length does not match'):
         S46DMROption.parse(
             bytes.fromhex('005b00112020010db8000000000000000000000000')
         )