# Path: netjsonconfig/backends/openwrt/openwrt.py
# class OpenWrt(BaseBackend):
#     """
#     OpenWRT / LEDE Configuration Backend
#     """
# 
#     schema = schema
#     converters = [
#         converters.General,
#         converters.Ntp,
#         converters.Led,
#         converters.Interfaces,
#         converters.Routes,
#         converters.Rules,
#         converters.Switch,
#         converters.Radios,
#         converters.Wireless,
#         converters.OpenVpn,
#         converters.WireguardPeers,
#         converters.Default,
#     ]
#     parser = OpenWrtParser
#     renderer = OpenWrtRenderer
#     list_identifiers = ['name', 'config_value', 'id']
# 
#     def _generate_contents(self, tar):
#         """
#         Adds configuration files to tarfile instance.
# 
#         :param tar: tarfile instance
#         :returns: None
#         """
#         uci = self.render(files=False)
#         # create a list with all the packages (and remove empty entries)
#         packages = packages_pattern.split(uci)
#         if '' in packages:
#             packages.remove('')
#         # create an UCI file for each configuration package used
#         for package in packages:
#             lines = package.split('\n')
#             package_name = lines[0]
#             text_contents = '\n'.join(lines[2:])
#             self._add_file(
#                 tar=tar,
#                 name='{0}{1}'.format(config_path, package_name),
#                 contents=text_contents,
#             )
# 
#     @classmethod
#     def wireguard_auto_client(cls, **kwargs):
#         data = Wireguard.auto_client(**kwargs)
#         config = {
#             'interfaces': [
#                 {
#                     'name': data['interface_name'],
#                     'type': 'wireguard',
#                     'private_key': data['client']['private_key'],
#                     'port': data['client']['port'],
#                     # Default values for Wireguard Interface
#                     'mtu': 1420,
#                     'nohostroute': False,
#                     'fwmark': '',
#                     'ip6prefix': [],
#                     'addresses': [],
#                     'network': '',
#                 }
#             ],
#             'wireguard_peers': [
#                 {
#                     'interface': data['interface_name'],
#                     'public_key': data['server']['public_key'],
#                     'allowed_ips': data['server']['allowed_ips'],
#                     'endpoint_host': data['server']['endpoint_host'],
#                     'endpoint_port': data['server']['endpoint_port'],
#                     # Default values for Wireguard Peers
#                     'preshared_key': '',
#                     'persistent_keepalive': 60,
#                     'route_allowed_ips': True,
#                 }
#             ],
#         }
#         if data['client']['ip_address']:
#             config['interfaces'][0]['addresses'] = [
#                 {
#                     'proto': 'static',
#                     'family': 'ipv4',
#                     'address': data['client']['ip_address'],
#                     'mask': 32,
#                 },
#             ]
#         return config
# 
#     @classmethod
#     def vxlan_wireguard_auto_client(cls, **kwargs):
#         config = cls.wireguard_auto_client(**kwargs)
#         vxlan_config = VxlanWireguard.auto_client(**kwargs)
#         vxlan_interface = {
#             'name': 'vxlan',
#             'type': 'vxlan',
#             'vtep': vxlan_config['server_ip_address'],
#             'port': 4789,
#             'vni': vxlan_config['vni'],
#             'tunlink': config['interfaces'][0]['name'],
#             # Default values for VXLAN interface
#             'rxcsum': True,
#             'txcsum': True,
#             'mtu': 1280,
#             'ttl': 64,
#             'mac': '',
#             'disabled': False,
#             'network': '',
#         }
#         config['interfaces'].append(vxlan_interface)
#         return config
# 
# Path: netjsonconfig/utils.py
# class _TabsMixin(object):  # pragma: nocover
#     """
#     mixin that adds _tabs method to test classes
#     """
# 
#     def _tabs(self, string):
#         """
#         replace 4 spaces with 1 tab
#         """
#         return string.replace('    ', '\t')


import json
import os
import tarfile
import unittest
from hashlib import md5
from time import sleep
from netjsonconfig import OpenWrt
from netjsonconfig.exceptions import ValidationError
from netjsonconfig.utils import _TabsMixin
                    'preshared_key': '',
                    'public_key': '',
                    'route_allowed_ips': True,
                }
            ],
        }

    def _get_vxlan_wireguard_empty_configuration(self):
        wireguard_config = self._get_wireguard_empty_configuration()
        vxlan_config = {
            'disabled': False,
            'mac': '',
            'mtu': 1280,
            'name': 'vxlan',
            'network': '',
            'port': 4789,
            'rxcsum': True,
            'ttl': 64,
            'tunlink': '',
            'txcsum': True,
            'type': 'vxlan',
            'vni': 0,
            'vtep': '',
        }
        wireguard_config['interfaces'].append(vxlan_config)
        return wireguard_config

    def test_wireguard_auto_client(self):
        with self.subTest('No arguments provided'):
            expected = self._get_wireguard_empty_configuration()

# Path: netjsonconfig/backends/openwrt/openwrt.py
# class OpenWrt(BaseBackend):
#     """
#     OpenWRT / LEDE Configuration Backend
#     """
# 
#     schema = schema
#     converters = [
#         converters.General,
#         converters.Ntp,
#         converters.Led,
#         converters.Interfaces,
#         converters.Routes,
#         converters.Rules,
#         converters.Switch,
#         converters.Radios,
#         converters.Wireless,
#         converters.OpenVpn,
#         converters.WireguardPeers,
#         converters.Default,
#     ]
#     parser = OpenWrtParser
#     renderer = OpenWrtRenderer
#     list_identifiers = ['name', 'config_value', 'id']
# 
#     def _generate_contents(self, tar):
#         """
#         Adds configuration files to tarfile instance.
# 
#         :param tar: tarfile instance
#         :returns: None
#         """
#         uci = self.render(files=False)
#         # create a list with all the packages (and remove empty entries)
#         packages = packages_pattern.split(uci)
#         if '' in packages:
#             packages.remove('')
#         # create an UCI file for each configuration package used
#         for package in packages:
#             lines = package.split('\n')
#             package_name = lines[0]
#             text_contents = '\n'.join(lines[2:])
#             self._add_file(
#                 tar=tar,
#                 name='{0}{1}'.format(config_path, package_name),
#                 contents=text_contents,
#             )
# 
#     @classmethod
#     def wireguard_auto_client(cls, **kwargs):
#         data = Wireguard.auto_client(**kwargs)
#         config = {
#             'interfaces': [
#                 {
#                     'name': data['interface_name'],
#                     'type': 'wireguard',
#                     'private_key': data['client']['private_key'],
#                     'port': data['client']['port'],
#                     # Default values for Wireguard Interface
#                     'mtu': 1420,
#                     'nohostroute': False,
#                     'fwmark': '',
#                     'ip6prefix': [],
#                     'addresses': [],
#                     'network': '',
#                 }
#             ],
#             'wireguard_peers': [
#                 {
#                     'interface': data['interface_name'],
#                     'public_key': data['server']['public_key'],
#                     'allowed_ips': data['server']['allowed_ips'],
#                     'endpoint_host': data['server']['endpoint_host'],
#                     'endpoint_port': data['server']['endpoint_port'],
#                     # Default values for Wireguard Peers
#                     'preshared_key': '',
#                     'persistent_keepalive': 60,
#                     'route_allowed_ips': True,
#                 }
#             ],
#         }
#         if data['client']['ip_address']:
#             config['interfaces'][0]['addresses'] = [
#                 {
#                     'proto': 'static',
#                     'family': 'ipv4',
#                     'address': data['client']['ip_address'],
#                     'mask': 32,
#                 },
#             ]
#         return config
# 
#     @classmethod
#     def vxlan_wireguard_auto_client(cls, **kwargs):
#         config = cls.wireguard_auto_client(**kwargs)
#         vxlan_config = VxlanWireguard.auto_client(**kwargs)
#         vxlan_interface = {
#             'name': 'vxlan',
#             'type': 'vxlan',
#             'vtep': vxlan_config['server_ip_address'],
#             'port': 4789,
#             'vni': vxlan_config['vni'],
#             'tunlink': config['interfaces'][0]['name'],
#             # Default values for VXLAN interface
#             'rxcsum': True,
#             'txcsum': True,
#             'mtu': 1280,
#             'ttl': 64,
#             'mac': '',
#             'disabled': False,
#             'network': '',
#         }
#         config['interfaces'].append(vxlan_interface)
#         return config
# 
# Path: netjsonconfig/utils.py
# class _TabsMixin(object):  # pragma: nocover
#     """
#     mixin that adds _tabs method to test classes
#     """
# 
#     def _tabs(self, string):
#         """
#         replace 4 spaces with 1 tab
#         """
#         return string.replace('    ', '\t')


# Path: tests/openwrt/test_backend.py
import json
import os
import tarfile
import unittest
from hashlib import md5
from time import sleep
from netjsonconfig import OpenWrt
from netjsonconfig.exceptions import ValidationError
from netjsonconfig.utils import _TabsMixin

                    'preshared_key': '',
                    'public_key': '',
                    'route_allowed_ips': True,
                }
            ],
        }

    def _get_vxlan_wireguard_empty_configuration(self):
        wireguard_config = self._get_wireguard_empty_configuration()
        vxlan_config = {
            'disabled': False,
            'mac': '',
            'mtu': 1280,
            'name': 'vxlan',
            'network': '',
            'port': 4789,
            'rxcsum': True,
            'ttl': 64,
            'tunlink': '',
            'txcsum': True,
            'type': 'vxlan',
            'vni': 0,
            'vtep': '',
        }
        wireguard_config['interfaces'].append(vxlan_config)
        return wireguard_config

    def test_wireguard_auto_client(self):
        with self.subTest('No arguments provided'):
            expected = self._get_wireguard_empty_configuration()

            self.assertDictEqual(OpenWrt.wireguard_auto_client(), expected)