# Path: netjsonconfig/backends/openwrt/schema.py



from collections import OrderedDict
from copy import deepcopy
from ipaddress import ip_address, ip_interface
from ..schema import schema
from .base import OpenWrtConverter
        return self._add_netjson_addresses(interface, proto)

    def _add_netjson_addresses(self, interface, proto):
        addresses = []
        ipv4 = interface.pop('ipaddr', [])
        ipv6 = interface.pop('ip6addr', [])
        if not isinstance(ipv4, list):
            netmask = interface.pop('netmask', 32)
            parsed_ip = self.__netjson_parse_ip(ipv4, netmask)
            ipv4 = [parsed_ip] if parsed_ip else []
        if not isinstance(ipv6, list):
            netmask = interface.pop('netmask', 128)
            parsed_ip = self.__netjson_parse_ip(ipv6, netmask)
            ipv6 = [parsed_ip] if parsed_ip else []
        if proto.startswith('dhcp'):
            family = 'ipv4' if proto == 'dhcp' else 'ipv6'
            addresses.append({'proto': 'dhcp', 'family': family})
        for address in ipv4 + ipv6:
            address = self.__netjson_parse_ip(address)
            if not address:
                continue
            addresses.append(self.__netjson_address(address, interface))
        if addresses:
            interface['addresses'] = addresses
        return interface

    def _netjson_dialup(self, interface):
        interface['type'] = 'dialup'
        return interface


# Path: netjsonconfig/backends/openwrt/schema.py



# Path: netjsonconfig/backends/openwrt/converters/interfaces.py
from collections import OrderedDict
from copy import deepcopy
from ipaddress import ip_address, ip_interface
from ..schema import schema
from .base import OpenWrtConverter

        return self._add_netjson_addresses(interface, proto)

    def _add_netjson_addresses(self, interface, proto):
        addresses = []
        ipv4 = interface.pop('ipaddr', [])
        ipv6 = interface.pop('ip6addr', [])
        if not isinstance(ipv4, list):
            netmask = interface.pop('netmask', 32)
            parsed_ip = self.__netjson_parse_ip(ipv4, netmask)
            ipv4 = [parsed_ip] if parsed_ip else []
        if not isinstance(ipv6, list):
            netmask = interface.pop('netmask', 128)
            parsed_ip = self.__netjson_parse_ip(ipv6, netmask)
            ipv6 = [parsed_ip] if parsed_ip else []
        if proto.startswith('dhcp'):
            family = 'ipv4' if proto == 'dhcp' else 'ipv6'
            addresses.append({'proto': 'dhcp', 'family': family})
        for address in ipv4 + ipv6:
            address = self.__netjson_parse_ip(address)
            if not address:
                continue
            addresses.append(self.__netjson_address(address, interface))
        if addresses:
            interface['addresses'] = addresses
        return interface

    def _netjson_dialup(self, interface):
        interface['type'] = 'dialup'
        return interface


    _modem_manager_schema = schema['definitions']['modemmanager_interface']['allOf'][0]