# Path: netjsonconfig/utils.py
# def sorted_dict(dict_):
#     return OrderedDict(sorted(dict_.items()))
# 
# Path: netjsonconfig/backends/base/parser.py
# class BaseParser(object):
#     """
#     Base Parser class
#     Parsers are used to parse a string or tar.gz
#     which represents the router configuration
#     """
# 
#     def __init__(self, config):
#         if isinstance(config, str):
#             data = self.parse_text(config)
#         # presence of read() method
#         # indicates a file-like object
#         elif hasattr(config, 'read'):
#             data = self.parse_tar(config)
#         else:
#             raise ParseError('Unrecognized format')
#         self.intermediate_data = data
# 
#     def parse_text(self, config):
#         raise NotImplementedError()
# 
#     def parse_tar(self, config):
#         raise NotImplementedError()


import re
import tarfile
from ...utils import sorted_dict
from ..base.parser import BaseParser


vpn_pattern = re.compile('^# openvpn config:\s', flags=re.MULTILINE)
config_pattern = re.compile('^([^\s]*) ?(.*)$')
config_suffix = '.conf'



# Path: netjsonconfig/utils.py
# def sorted_dict(dict_):
#     return OrderedDict(sorted(dict_.items()))
# 
# Path: netjsonconfig/backends/base/parser.py
# class BaseParser(object):
#     """
#     Base Parser class
#     Parsers are used to parse a string or tar.gz
#     which represents the router configuration
#     """
# 
#     def __init__(self, config):
#         if isinstance(config, str):
#             data = self.parse_text(config)
#         # presence of read() method
#         # indicates a file-like object
#         elif hasattr(config, 'read'):
#             data = self.parse_tar(config)
#         else:
#             raise ParseError('Unrecognized format')
#         self.intermediate_data = data
# 
#     def parse_text(self, config):
#         raise NotImplementedError()
# 
#     def parse_tar(self, config):
#         raise NotImplementedError()


# Path: netjsonconfig/backends/openvpn/parser.py
import re
import tarfile
from ...utils import sorted_dict
from ..base.parser import BaseParser



vpn_pattern = re.compile('^# openvpn config:\s', flags=re.MULTILINE)
config_pattern = re.compile('^([^\s]*) ?(.*)$')
config_suffix = '.conf'



class OpenVpnParser(BaseParser):