wan: return ip6prefixes as list
When user set protocol 6in4 to wan6 interface using LuCi, it store ip6prefix
as list (list ip6prefix
). (re)Foris on the other hand store it as option ip6prefix
.
This leads to crash of foris-controller with following stacktrace:
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/foris_controller/message_router.py", line 140, in process_message
File "/usr/lib/python3.7/site-packages/foris_controller/message_router.py", line 40, in wrapper
File "/usr/lib/python3.7/site-packages/foris_controller/message_router.py", line 76, in validate
File "/usr/lib/python3.7/site-packages/foris_schema/validator.py", line 257, in validate
File "/usr/lib/python3.7/site-packages/jsonschema/validators.py", line 353, in validate
jsonschema.exceptions.ValidationError: {'wan6_type': '6in4', 'wan6_6in4': {'ipv6_prefix': ['2001:470:519b::/48'], 'mtu': 1480, 'server_ipv4': '216.66.86.114', 'dynamic_ipv4': {'enabled': True, 'tunnel_id': '578704', 'username': 'IPv6scherge', 'password_or_key': 'EZY3heY7332-'}}} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['data']['properties']['wan6_settings']:
{'oneOf': [{'additionalProperties': False,
'properties': {'wan6_type': {'allOf': [{'$ref': '#/definitions/wan6_type'},
{'enum': ['none']}]}},
'required': ['wan6_type'],
'type': 'object'},
{'additionalProperties': False,
'properties': {'wan6_dhcpv6': {'$ref': '#/definitions/network_settings_6_dhcpv6'},
'wan6_type': {'allOf': [{'$ref': '#/definitions/wan6_type'},
{'enum': ['dhcpv6']}]}},
'required': ['wan6_type', 'wan6_dhcpv6'],
'type': 'object'},
{'additionalProperties': False,
'properties': {'wan6_static': {'$ref': '#/definitions/network_settings_6_static'},
'wan6_type': {'allOf': [{'$ref': '#/definitions/wan6_type'},
{'enum': ['static']}]}},
'required': ['wan6_type', 'wan6_static'],
'type': 'object'},
{'additionalProperties': False,
'properties': {'wan6_6to4': {'$ref': '#/definitions/network_settings_6_6to4'},
'wan6_type': {'allOf': [{'$ref': '#/definitions/wan6_type'},
{'enum': ['6to4']}]}},
'required': ['wan6_type', 'wan6_6to4'],
'type': 'object'},
{'additionalProperties': False,
'properties': {'wan6_6in4': {'$ref': '#/definitions/network_settings_6_6in4'},
'wan6_type': {'allOf': [{'$ref': '#/definitions/wan6_type'},
{'enum': ['6in4']}]}},
'required': ['wan6_type', 'wan6_6in4'],
'type': 'object'}]}
On instance['data']['wan6_settings']:
{'wan6_6in4': {'dynamic_ipv4': {'enabled': True,
'password_or_key': 'redacted-',
'tunnel_id': '578704',
'username': 'redacted'},
'ipv6_prefix': ['2001:470:519b::/48'],
'mtu': 1480,
'server_ipv4': '216.66.86.114'},
'wan6_type': '6in4'}
Return and save ipv6 prefixes as list.
Original support ticket: #1080655